@lattice-php/lattice 0.14.0 → 0.16.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/action/components/action-group.js +1 -1
- package/dist/action/components/action-group.js.map +1 -1
- package/dist/action/components/action-menu-context.d.ts +1 -1
- package/dist/action/components/action-menu-context.js +1 -1
- package/dist/action/components/action-menu-context.js.map +1 -1
- package/dist/core/components/card.js +4 -4
- package/dist/core/components/card.js.map +1 -1
- package/dist/core/components/chart.js +49 -2
- package/dist/core/components/chart.js.map +1 -1
- package/dist/core/components/collapsible.js +1 -0
- package/dist/core/components/collapsible.js.map +1 -1
- package/dist/core/components/control.d.ts +1 -1
- package/dist/core/components/dialog.d.ts +1 -1
- package/dist/core/components/dialog.js +2 -2
- package/dist/core/components/dialog.js.map +1 -1
- package/dist/core/components/floating-panel.js +2 -2
- package/dist/core/components/floating-panel.js.map +1 -1
- package/dist/core/components/grid.js +1 -0
- package/dist/core/components/grid.js.map +1 -1
- package/dist/core/components/link.js +61 -3
- package/dist/core/components/link.js.map +1 -1
- package/dist/core/components/popover.d.ts +1 -1
- package/dist/core/components/popover.js +1 -1
- package/dist/core/components/popover.js.map +1 -1
- package/dist/core/components/section.js +4 -3
- package/dist/core/components/section.js.map +1 -1
- package/dist/core/components/stack.js +1 -0
- package/dist/core/components/stack.js.map +1 -1
- package/dist/form/components/base/submit-button.js +1 -1
- package/dist/form/components/base/submit-button.js.map +1 -1
- package/dist/form/components/fields/date-picker-control.js +13 -15
- package/dist/form/components/fields/date-picker-control.js.map +1 -1
- package/dist/form/components/fields/rich-editor.js +1 -1
- package/dist/form/components/fields/rich-editor.js.map +1 -1
- package/dist/form/components/fields/time-input.js +54 -15
- package/dist/form/components/fields/time-input.js.map +1 -1
- package/dist/form/components/fields/time-picker-columns.d.ts +23 -0
- package/dist/form/components/fields/time-picker-columns.js +76 -0
- package/dist/form/components/fields/time-picker-columns.js.map +1 -0
- package/dist/form/components/fields/time-picker.d.ts +17 -0
- package/dist/form/components/fields/time-picker.js +132 -0
- package/dist/form/components/fields/time-picker.js.map +1 -0
- package/dist/form/components/form.js +2 -1
- package/dist/form/components/form.js.map +1 -1
- package/dist/format/number.d.ts +2 -0
- package/dist/format/number.js +23 -0
- package/dist/format/number.js.map +1 -0
- package/dist/{table/components/cells → format}/numeric.js +1 -1
- package/dist/format/numeric.js.map +1 -0
- package/dist/format/value.d.ts +6 -0
- package/dist/format/value.js +17 -0
- package/dist/format/value.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/lattice.css +68 -36
- package/dist/layout/menu-item.js +1 -1
- package/dist/layout/menu-item.js.map +1 -1
- package/dist/layout/sidebar.js +2 -2
- package/dist/layout/sidebar.js.map +1 -1
- package/dist/layout/topbar.js +1 -1
- package/dist/layout/topbar.js.map +1 -1
- package/dist/table/components/cells/money-cell.js +11 -12
- package/dist/table/components/cells/money-cell.js.map +1 -1
- package/dist/table/components/cells/number-cell.js +11 -11
- package/dist/table/components/cells/number-cell.js.map +1 -1
- package/dist/table/components/column-filter-control.js +2 -2
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/filter-controls.js +2 -2
- package/dist/table/components/filter-controls.js.map +1 -1
- package/dist/table/components/pagination.js +7 -6
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/table.js +9 -3
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/format.d.ts +2 -0
- package/dist/table/format.js +2 -0
- package/dist/table/format.js.map +1 -1
- package/dist/toast/toaster.js +1 -1
- package/dist/toast/toaster.js.map +1 -1
- package/dist/types/generated.d.ts +21 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/resources/icons/clock.svg +16 -0
- package/dist/table/components/cells/numeric.js.map +0 -1
- /package/dist/{table/components/cells → format}/numeric.d.ts +0 -0
|
@@ -23,7 +23,7 @@ var ActionGroupComponent = ({ children, node }) => {
|
|
|
23
23
|
asChild: true,
|
|
24
24
|
children: /* @__PURE__ */ jsx(Button, {
|
|
25
25
|
"aria-label": label,
|
|
26
|
-
className: "size-
|
|
26
|
+
className: "size-lt-control-sm text-lt-muted-fg shadow-none hover:text-lt-fg",
|
|
27
27
|
"data-test": nodeIdentity(node),
|
|
28
28
|
size: "icon",
|
|
29
29
|
type: "button",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-group.js","names":[],"sources":["../../../resources/js/action/components/action-group.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { Button } from \"@lattice-php/lattice/core/components/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"@lattice-php/lattice/core/components/dropdown-menu\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { ActionMenuProvider } from \"./action-menu-context\";\n\nconst ActionGroupComponent: RendererComponent<\"action.group\"> = ({ children, node }) => {\n const label = node.props.label;\n const orientation = node.props.orientation;\n\n if (orientation) {\n return (\n <div\n aria-label={label}\n className={cn(\n \"inline-flex max-w-full gap-1\",\n orientation === \"vertical\" ? \"flex-col items-stretch\" : \"flex-row flex-wrap items-center\",\n )}\n data-lattice-component={node.id}\n role=\"group\"\n >\n {children}\n </div>\n );\n }\n\n return (\n <div className=\"inline-flex\" data-lattice-component={node.id}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n aria-label={label}\n className=\"size-
|
|
1
|
+
{"version":3,"file":"action-group.js","names":[],"sources":["../../../resources/js/action/components/action-group.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { Button } from \"@lattice-php/lattice/core/components/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"@lattice-php/lattice/core/components/dropdown-menu\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { ActionMenuProvider } from \"./action-menu-context\";\n\nconst ActionGroupComponent: RendererComponent<\"action.group\"> = ({ children, node }) => {\n const label = node.props.label;\n const orientation = node.props.orientation;\n\n if (orientation) {\n return (\n <div\n aria-label={label}\n className={cn(\n \"inline-flex max-w-full gap-1\",\n orientation === \"vertical\" ? \"flex-col items-stretch\" : \"flex-row flex-wrap items-center\",\n )}\n data-lattice-component={node.id}\n role=\"group\"\n >\n {children}\n </div>\n );\n }\n\n return (\n <div className=\"inline-flex\" data-lattice-component={node.id}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n aria-label={label}\n className=\"size-lt-control-sm text-lt-muted-fg shadow-none hover:text-lt-fg\"\n data-test={nodeIdentity(node)}\n size=\"icon\"\n type=\"button\"\n variant=\"ghost\"\n >\n <Icon name=\"more-horizontal\" aria-hidden=\"true\" className=\"size-lt-icon-md\" />\n </Button>\n </DropdownMenuTrigger>\n\n <DropdownMenuContent\n align=\"end\"\n aria-label={label}\n className=\"min-w-44 gap-0.5 p-1.5\"\n sideOffset={8}\n >\n <ActionMenuProvider>{children}</ActionMenuProvider>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n\nexport default ActionGroupComponent;\n"],"mappings":";;;;;;;;AAYA,IAAM,wBAA2D,EAAE,UAAU,WAAW;CACtF,MAAM,QAAQ,KAAK,MAAM;CACzB,MAAM,cAAc,KAAK,MAAM;CAE/B,IAAI,aACF,OACE,oBAAC,OAAD;EACE,cAAY;EACZ,WAAW,GACT,gCACA,gBAAgB,aAAa,2BAA2B,iCAC1D;EACA,0BAAwB,KAAK;EAC7B,MAAK;EAEJ;CACE,CAAA;CAIT,OACE,oBAAC,OAAD;EAAK,WAAU;EAAc,0BAAwB,KAAK;YACxD,qBAAC,cAAD,EAAA,UAAA,CACE,oBAAC,qBAAD;GAAqB,SAAA;aACnB,oBAAC,QAAD;IACE,cAAY;IACZ,WAAU;IACV,aAAW,aAAa,IAAI;IAC5B,MAAK;IACL,MAAK;IACL,SAAQ;cAER,oBAAC,MAAD;KAAM,MAAK;KAAkB,eAAY;KAAO,WAAU;IAAmB,CAAA;GACvE,CAAA;EACW,CAAA,GAErB,oBAAC,qBAAD;GACE,OAAM;GACN,cAAY;GACZ,WAAU;GACV,YAAY;aAEZ,oBAAC,oBAAD,EAAqB,SAA6B,CAAA;EAC/B,CAAA,CACT,EAAA,CAAA;CACX,CAAA;AAET"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export declare const actionMenuItemClassName = "flex h-
|
|
2
|
+
export declare const actionMenuItemClassName = "flex h-lt-control-sm w-full items-center justify-start gap-2 rounded-lt-sm px-2.5 text-left text-sm font-normal text-lt-popover-fg no-underline decoration-transparent shadow-none transition-colors hover:bg-lt-accent/70 hover:text-lt-popover-fg focus-visible:bg-lt-accent/70 focus-visible:text-lt-popover-fg focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-lt-icon-sm [&_svg]:text-lt-muted-fg";
|
|
3
3
|
export declare function ActionMenuProvider({ children }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
}): import("react").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { createContext, useContext } from "react";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region resources/js/action/components/action-menu-context.tsx
|
|
4
4
|
var ActionMenuContext = createContext(false);
|
|
5
|
-
var actionMenuItemClassName = "flex h-
|
|
5
|
+
var actionMenuItemClassName = "flex h-lt-control-sm w-full items-center justify-start gap-2 rounded-lt-sm px-2.5 text-left text-sm font-normal text-lt-popover-fg no-underline decoration-transparent shadow-none transition-colors hover:bg-lt-accent/70 hover:text-lt-popover-fg focus-visible:bg-lt-accent/70 focus-visible:text-lt-popover-fg focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-lt-icon-sm [&_svg]:text-lt-muted-fg";
|
|
6
6
|
function ActionMenuProvider({ children }) {
|
|
7
7
|
return /* @__PURE__ */ jsx(ActionMenuContext.Provider, {
|
|
8
8
|
value: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu-context.js","names":[],"sources":["../../../resources/js/action/components/action-menu-context.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\nconst ActionMenuContext = createContext(false);\n\nexport const actionMenuItemClassName =\n \"flex h-
|
|
1
|
+
{"version":3,"file":"action-menu-context.js","names":[],"sources":["../../../resources/js/action/components/action-menu-context.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\nconst ActionMenuContext = createContext(false);\n\nexport const actionMenuItemClassName =\n \"flex h-lt-control-sm w-full items-center justify-start gap-2 rounded-lt-sm px-2.5 text-left text-sm font-normal text-lt-popover-fg no-underline decoration-transparent shadow-none transition-colors hover:bg-lt-accent/70 hover:text-lt-popover-fg focus-visible:bg-lt-accent/70 focus-visible:text-lt-popover-fg focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-lt-icon-sm [&_svg]:text-lt-muted-fg\";\n\nexport function ActionMenuProvider({ children }: { children: ReactNode }) {\n return <ActionMenuContext.Provider value={true}>{children}</ActionMenuContext.Provider>;\n}\n\nexport function useActionMenu(): boolean {\n return useContext(ActionMenuContext);\n}\n"],"mappings":";;;AAEA,IAAM,oBAAoB,cAAc,KAAK;AAE7C,IAAa,0BACX;AAEF,SAAgB,mBAAmB,EAAE,YAAqC;CACxE,OAAO,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO;EAAO;CAAqC,CAAA;AACxF;AAEA,SAAgB,gBAAyB;CACvC,OAAO,WAAW,iBAAiB;AACrC"}
|
|
@@ -7,14 +7,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
function Card({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("article", {
|
|
9
9
|
"data-slot": "card",
|
|
10
|
-
className: cn("flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-
|
|
10
|
+
className: cn("flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm", className),
|
|
11
11
|
...props
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
function CardHeader({ className, ...props }) {
|
|
15
15
|
return /* @__PURE__ */ jsx("div", {
|
|
16
16
|
"data-slot": "card-header",
|
|
17
|
-
className: cn("flex flex-col gap-1.5 px-
|
|
17
|
+
className: cn("flex flex-col gap-1.5 px-lt-gutter", className),
|
|
18
18
|
...props
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -35,14 +35,14 @@ function CardDescription({ className, ...props }) {
|
|
|
35
35
|
function CardContent({ className, ...props }) {
|
|
36
36
|
return /* @__PURE__ */ jsx("div", {
|
|
37
37
|
"data-slot": "card-content",
|
|
38
|
-
className: cn("px-
|
|
38
|
+
className: cn("px-lt-gutter", className),
|
|
39
39
|
...props
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function CardFooter({ className, ...props }) {
|
|
43
43
|
return /* @__PURE__ */ jsx("div", {
|
|
44
44
|
"data-slot": "card-footer",
|
|
45
|
-
className: cn("flex items-center px-
|
|
45
|
+
className: cn("flex items-center px-lt-gutter", className),
|
|
46
46
|
...props
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":[],"sources":["../../../resources/js/core/components/card.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { InfoTooltip } from \"./info-tooltip\";\n\nfunction Card({ className, ...props }: React.ComponentProps<\"article\">) {\n return (\n <article\n data-slot=\"card\"\n className={cn(\n \"flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-
|
|
1
|
+
{"version":3,"file":"card.js","names":[],"sources":["../../../resources/js/core/components/card.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { InfoTooltip } from \"./info-tooltip\";\n\nfunction Card({ className, ...props }: React.ComponentProps<\"article\">) {\n return (\n <article\n data-slot=\"card\"\n className={cn(\n \"flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\"flex flex-col gap-1.5 px-lt-gutter\", className)}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\"font-semibold leading-none\", className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm text-lt-muted-fg\", className)}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div data-slot=\"card-content\" className={cn(\"px-lt-gutter\", className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\"flex items-center px-lt-gutter\", className)}\n {...props}\n />\n );\n}\n\nconst CardComponent: RendererComponent<\"card\"> = ({ children, node }) => {\n const { title, description, tooltip } = node.props;\n\n return (\n <Card data-lattice-component={nodeIdentity(node)}>\n {(title || description) && (\n <CardHeader>\n {title && (\n <div className=\"flex items-center\">\n <CardTitle>{title}</CardTitle>\n <InfoTooltip content={tooltip} />\n </div>\n )}\n {description && (\n <div className=\"flex items-center\">\n <CardDescription>{description}</CardDescription>\n {!title && <InfoTooltip content={tooltip} />}\n </div>\n )}\n </CardHeader>\n )}\n {children && <CardContent className=\"flex flex-col gap-6\">{children}</CardContent>}\n </Card>\n );\n};\n\nexport default CardComponent;\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\n"],"mappings":";;;;;;AAMA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0C;CACtE,OACE,oBAAC,WAAD;EACE,aAAU;EACV,WAAW,GACT,qHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,sCAAsC,SAAS;EAC7D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,UAAU,EAAE,WAAW,GAAG,SAAsC;CACvE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,8BAA8B,SAAS;EACrD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAsC;CAC7E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,4BAA4B,SAAS;EACnD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;CACzE,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAe,WAAW,GAAG,gBAAgB,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC7F;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,kCAAkC,SAAS;EACzD,GAAI;CACL,CAAA;AAEL;AAEA,IAAM,iBAA4C,EAAE,UAAU,WAAW;CACvE,MAAM,EAAE,OAAO,aAAa,YAAY,KAAK;CAE7C,OACE,qBAAC,MAAD;EAAM,0BAAwB,aAAa,IAAI;YAA/C,EACI,SAAS,gBACT,qBAAC,YAAD,EAAA,UAAA,CACG,SACC,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,WAAD,EAAA,UAAY,MAAiB,CAAA,GAC7B,oBAAC,aAAD,EAAa,SAAS,QAAU,CAAA,CAC7B;MAEN,eACC,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,iBAAD,EAAA,UAAkB,YAA6B,CAAA,GAC9C,CAAC,SAAS,oBAAC,aAAD,EAAa,SAAS,QAAU,CAAA,CACxC;IAEG,EAAA,CAAA,GAEb,YAAY,oBAAC,aAAD;GAAa,WAAU;GAAuB;EAAsB,CAAA,CAC7E;;AAEV"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { useLocale } from "../../i18n/locale.js";
|
|
2
|
+
import { useTimezone } from "../../i18n/timezone.js";
|
|
1
3
|
import { nodeIdentity } from "../test-id.js";
|
|
4
|
+
import { formatValue } from "../../format/value.js";
|
|
2
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
6
|
import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, ComposedChart, Legend, Line, LineChart, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
|
4
7
|
//#region resources/js/core/components/chart.tsx
|
|
@@ -20,6 +23,18 @@ var compactLegendProps = {
|
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
25
|
var axisTick = { fontSize: 10 };
|
|
26
|
+
var tooltipProps = {
|
|
27
|
+
contentStyle: {
|
|
28
|
+
background: "var(--lt-surface)",
|
|
29
|
+
border: "1px solid var(--lt-border)",
|
|
30
|
+
borderRadius: "var(--lt-radius-sm)",
|
|
31
|
+
boxShadow: "var(--lt-shadow-sm)",
|
|
32
|
+
color: "var(--lt-surface-fg)",
|
|
33
|
+
fontSize: 12
|
|
34
|
+
},
|
|
35
|
+
itemStyle: { color: "var(--lt-surface-fg)" },
|
|
36
|
+
labelStyle: { color: "var(--lt-muted-fg)" }
|
|
37
|
+
};
|
|
23
38
|
var palette = [
|
|
24
39
|
"var(--lt-primary)",
|
|
25
40
|
"var(--lt-success)",
|
|
@@ -70,6 +85,21 @@ function ChartFrame({ children, description, id, title }) {
|
|
|
70
85
|
function CartesianChart({ props }) {
|
|
71
86
|
const series = props.series.filter(isCartesianSeries);
|
|
72
87
|
const RechartsChart = cartesianChartFor(series);
|
|
88
|
+
const { locale } = useLocale();
|
|
89
|
+
const { timezone } = useTimezone();
|
|
90
|
+
const ctx = {
|
|
91
|
+
locale,
|
|
92
|
+
timezone
|
|
93
|
+
};
|
|
94
|
+
const formatCategory = (value) => formatValue(value, props.categoryFormat, ctx);
|
|
95
|
+
const formatValueTick = (value) => formatValue(value, props.valueFormat, ctx);
|
|
96
|
+
const tooltipCursor = series.some((item) => item.type === "bar") ? {
|
|
97
|
+
fill: "var(--lt-muted-fg)",
|
|
98
|
+
fillOpacity: .15
|
|
99
|
+
} : {
|
|
100
|
+
stroke: "var(--lt-muted-fg)",
|
|
101
|
+
strokeOpacity: .4
|
|
102
|
+
};
|
|
73
103
|
return /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
74
104
|
width: "100%",
|
|
75
105
|
height: props.height,
|
|
@@ -86,15 +116,22 @@ function CartesianChart({ props }) {
|
|
|
86
116
|
dataKey: props.categoryKey,
|
|
87
117
|
stroke: "var(--lt-muted-fg)",
|
|
88
118
|
tick: axisTick,
|
|
119
|
+
tickFormatter: formatCategory,
|
|
89
120
|
tickLine: false
|
|
90
121
|
}),
|
|
91
122
|
props.yAxis && /* @__PURE__ */ jsx(YAxis, {
|
|
92
123
|
stroke: "var(--lt-muted-fg)",
|
|
93
124
|
tick: axisTick,
|
|
125
|
+
tickFormatter: formatValueTick,
|
|
94
126
|
tickLine: false,
|
|
95
127
|
width: 42
|
|
96
128
|
}),
|
|
97
|
-
props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
|
|
129
|
+
props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
|
|
130
|
+
...tooltipProps,
|
|
131
|
+
cursor: tooltipCursor,
|
|
132
|
+
formatter: formatValueTick,
|
|
133
|
+
labelFormatter: formatCategory
|
|
134
|
+
}),
|
|
98
135
|
props.legend && /* @__PURE__ */ jsx(Legend, { ...compactLegendProps }),
|
|
99
136
|
series.map((item, index) => {
|
|
100
137
|
const color = item.color ?? colorAt(index);
|
|
@@ -134,6 +171,12 @@ function CartesianChart({ props }) {
|
|
|
134
171
|
});
|
|
135
172
|
}
|
|
136
173
|
function PieChartView({ props, series }) {
|
|
174
|
+
const { locale } = useLocale();
|
|
175
|
+
const { timezone } = useTimezone();
|
|
176
|
+
const ctx = {
|
|
177
|
+
locale,
|
|
178
|
+
timezone
|
|
179
|
+
};
|
|
137
180
|
return /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
138
181
|
width: "100%",
|
|
139
182
|
height: props.height,
|
|
@@ -141,7 +184,11 @@ function PieChartView({ props, series }) {
|
|
|
141
184
|
children: /* @__PURE__ */ jsxs(PieChart, {
|
|
142
185
|
margin: chartMargin,
|
|
143
186
|
children: [
|
|
144
|
-
props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
|
|
187
|
+
props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
|
|
188
|
+
...tooltipProps,
|
|
189
|
+
formatter: (value) => formatValue(value, props.valueFormat, ctx),
|
|
190
|
+
labelFormatter: (value) => formatValue(value, props.categoryFormat, ctx)
|
|
191
|
+
}),
|
|
145
192
|
props.legend && /* @__PURE__ */ jsx(Legend, { ...compactLegendProps }),
|
|
146
193
|
/* @__PURE__ */ jsx(Pie, {
|
|
147
194
|
data: props.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","names":[],"sources":["../../../resources/js/core/components/chart.tsx"],"sourcesContent":["import {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n ComposedChart,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { PropsOf, RendererComponent } from \"@lattice-php/lattice/core/types\";\n\ntype ChartProps = PropsOf<\"chart\">;\ntype ChartSeries = ChartProps[\"series\"][number];\ntype ChartDatum = ChartProps[\"data\"][number];\ntype CartesianSeries = ChartSeries & { type: \"area\" | \"bar\" | \"line\" };\ntype ChartMargin = { bottom: number; left: number; right: number; top: number };\ntype CartesianChartComponent = ComponentType<{\n children: ReactNode;\n data: ChartProps[\"data\"];\n margin?: ChartMargin;\n}>;\n\nconst chartMargin: ChartMargin = { bottom: 0, left: 0, right: 16, top: 8 };\nconst compactLegendProps = {\n align: \"center\" as const,\n height: 24,\n iconSize: 7,\n verticalAlign: \"top\" as const,\n wrapperStyle: { fontSize: 11, lineHeight: \"14px\", paddingBottom: 6 },\n};\nconst axisTick = { fontSize: 10 };\n\nconst palette = [\n \"var(--lt-primary)\",\n \"var(--lt-success)\",\n \"var(--lt-info)\",\n \"var(--lt-warning)\",\n \"var(--lt-danger)\",\n \"var(--lt-muted-fg)\",\n];\n\nfunction colorAt(index: number): string {\n return palette[index % palette.length] ?? \"var(--lt-primary)\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction datumColor(datum: ChartDatum, series: ChartSeries, index: number): string {\n if (isRecord(datum) && typeof datum.color === \"string\") {\n return datum.color;\n }\n\n return series.color ?? colorAt(index);\n}\n\nfunction isCartesianSeries(series: ChartSeries): series is CartesianSeries {\n return series.type === \"area\" || series.type === \"bar\" || series.type === \"line\";\n}\n\nfunction cartesianChartFor(series: CartesianSeries[]): CartesianChartComponent {\n const types = new Set(series.map((item) => item.type));\n const firstSeries = series[0];\n\n if (firstSeries === undefined || types.size !== 1) {\n return ComposedChart;\n }\n\n switch (firstSeries.type) {\n case \"area\":\n return AreaChart;\n case \"bar\":\n return BarChart;\n case \"line\":\n return LineChart;\n }\n}\n\nfunction ChartFrame({\n children,\n description,\n id,\n title,\n}: {\n children: ReactNode;\n description: string | null;\n id?: string;\n title: string | null;\n}) {\n const hasHeader = title !== null || description !== null;\n\n return (\n <div\n className=\"flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={id}\n >\n {hasHeader && (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title !== null && <div className=\"text-sm font-semibold leading-tight\">{title}</div>}\n {description !== null && (\n <div className=\"text-xs leading-5 text-lt-muted-fg\">{description}</div>\n )}\n </div>\n )}\n {children}\n </div>\n );\n}\n\nfunction CartesianChart({ props }: { props: ChartProps }) {\n const series = props.series.filter(isCartesianSeries);\n const RechartsChart = cartesianChartFor(series);\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <RechartsChart data={props.data} margin={chartMargin}>\n {props.grid && <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--lt-border)\" />}\n {props.xAxis && props.categoryKey !== null && (\n <XAxis\n dataKey={props.categoryKey}\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickLine={false}\n />\n )}\n {props.yAxis && (\n <YAxis stroke=\"var(--lt-muted-fg)\" tick={axisTick} tickLine={false} width={42} />\n )}\n {props.tooltip && <Tooltip />}\n {props.legend && <Legend {...compactLegendProps} />}\n {series.map((item, index) => {\n const color = item.color ?? colorAt(index);\n const key = `${item.type}:${item.dataKey}`;\n\n if (item.type === \"area\") {\n return (\n <Area\n key={key}\n dataKey={item.dataKey}\n fill={color}\n fillOpacity={0.16}\n name={item.name ?? undefined}\n stackId={item.stackId ?? undefined}\n stroke={color}\n type=\"monotone\"\n />\n );\n }\n\n if (item.type === \"bar\") {\n return (\n <Bar\n key={key}\n dataKey={item.dataKey}\n fill={color}\n name={item.name ?? undefined}\n radius={[4, 4, 0, 0]}\n stackId={item.stackId ?? undefined}\n />\n );\n }\n\n return (\n <Line\n key={key}\n dataKey={item.dataKey}\n dot={false}\n name={item.name ?? undefined}\n stroke={color}\n strokeWidth={2}\n type=\"monotone\"\n />\n );\n })}\n </RechartsChart>\n </ResponsiveContainer>\n );\n}\n\nfunction PieChartView({ props, series }: { props: ChartProps; series: ChartSeries }) {\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <PieChart margin={chartMargin}>\n {props.tooltip && <Tooltip />}\n {props.legend && <Legend {...compactLegendProps} />}\n <Pie\n data={props.data}\n dataKey={series.dataKey}\n name={series.name ?? undefined}\n nameKey={series.nameKey ?? undefined}\n outerRadius=\"68%\"\n >\n {props.data.map((datum, index) => (\n <Cell key={index} fill={datumColor(datum, series, index)} />\n ))}\n </Pie>\n </PieChart>\n </ResponsiveContainer>\n );\n}\n\nconst ChartComponent: RendererComponent<\"chart\"> = ({ node }) => {\n const props = node.props;\n const pieSeries = props.series.find((series) => series.type === \"pie\");\n const hasCartesianSeries = props.series.some(isCartesianSeries);\n\n return (\n <ChartFrame description={props.description} id={nodeIdentity(node)} title={props.title}>\n <div className=\"min-h-0 w-full\">\n {pieSeries && !hasCartesianSeries ? (\n <PieChartView props={props} series={pieSeries} />\n ) : (\n <CartesianChart props={props} />\n )}\n </div>\n </ChartFrame>\n );\n};\n\nexport default ChartComponent;\n"],"mappings":";;;;AAiCA,IAAM,cAA2B;CAAE,QAAQ;CAAG,MAAM;CAAG,OAAO;CAAI,KAAK;AAAE;AACzE,IAAM,qBAAqB;CACzB,OAAO;CACP,QAAQ;CACR,UAAU;CACV,eAAe;CACf,cAAc;EAAE,UAAU;EAAI,YAAY;EAAQ,eAAe;CAAE;AACrE;AACA,IAAM,WAAW,EAAE,UAAU,GAAG;AAEhC,IAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,QAAQ,QAAQ,WAAW;AAC5C;AAEA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EAAQ,GAAI,mBAAqB,CAAA;IAClD,oBAAC,KAAD;KACE,MAAM,MAAM;KACZ,SAAS,OAAO;KAChB,MAAM,OAAO,QAAQ,KAAA;KACrB,SAAS,OAAO,WAAW,KAAA;KAC3B,aAAY;eAEX,MAAM,KAAK,KAAK,OAAO,UACtB,oBAAC,MAAD,EAAkB,MAAM,WAAW,OAAO,QAAQ,KAAK,EAAI,GAAhD,KAAgD,CAC5D;IACE,CAAA;GACG;;CACS,CAAA;AAEzB;AAEA,IAAM,kBAA8C,EAAE,WAAW;CAC/D,MAAM,QAAQ,KAAK;CACnB,MAAM,YAAY,MAAM,OAAO,MAAM,WAAW,OAAO,SAAS,KAAK;CACrE,MAAM,qBAAqB,MAAM,OAAO,KAAK,iBAAiB;CAE9D,OACE,oBAAC,YAAD;EAAY,aAAa,MAAM;EAAa,IAAI,aAAa,IAAI;EAAG,OAAO,MAAM;YAC/E,oBAAC,OAAD;GAAK,WAAU;aACZ,aAAa,CAAC,qBACb,oBAAC,cAAD;IAAqB;IAAO,QAAQ;GAAY,CAAA,IAEhD,oBAAC,gBAAD,EAAuB,MAAQ,CAAA;EAE9B,CAAA;CACK,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"chart.js","names":[],"sources":["../../../resources/js/core/components/chart.tsx"],"sourcesContent":["import {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n ComposedChart,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { PropsOf, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useLocale, useTimezone } from \"@lattice-php/lattice/i18n\";\nimport { formatValue } from \"../../format/value\";\n\ntype ChartProps = PropsOf<\"chart\">;\ntype ChartSeries = ChartProps[\"series\"][number];\ntype ChartDatum = ChartProps[\"data\"][number];\ntype CartesianSeries = ChartSeries & { type: \"area\" | \"bar\" | \"line\" };\ntype ChartMargin = { bottom: number; left: number; right: number; top: number };\ntype CartesianChartComponent = ComponentType<{\n children: ReactNode;\n data: ChartProps[\"data\"];\n margin?: ChartMargin;\n}>;\n\nconst chartMargin: ChartMargin = { bottom: 0, left: 0, right: 16, top: 8 };\nconst compactLegendProps = {\n align: \"center\" as const,\n height: 24,\n iconSize: 7,\n verticalAlign: \"top\" as const,\n wrapperStyle: { fontSize: 11, lineHeight: \"14px\", paddingBottom: 6 },\n};\nconst axisTick = { fontSize: 10 };\nconst tooltipProps = {\n contentStyle: {\n background: \"var(--lt-surface)\",\n border: \"1px solid var(--lt-border)\",\n borderRadius: \"var(--lt-radius-sm)\",\n boxShadow: \"var(--lt-shadow-sm)\",\n color: \"var(--lt-surface-fg)\",\n fontSize: 12,\n },\n itemStyle: { color: \"var(--lt-surface-fg)\" },\n labelStyle: { color: \"var(--lt-muted-fg)\" },\n} as const;\n\nconst palette = [\n \"var(--lt-primary)\",\n \"var(--lt-success)\",\n \"var(--lt-info)\",\n \"var(--lt-warning)\",\n \"var(--lt-danger)\",\n \"var(--lt-muted-fg)\",\n];\n\nfunction colorAt(index: number): string {\n return palette[index % palette.length] ?? \"var(--lt-primary)\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction datumColor(datum: ChartDatum, series: ChartSeries, index: number): string {\n if (isRecord(datum) && typeof datum.color === \"string\") {\n return datum.color;\n }\n\n return series.color ?? colorAt(index);\n}\n\nfunction isCartesianSeries(series: ChartSeries): series is CartesianSeries {\n return series.type === \"area\" || series.type === \"bar\" || series.type === \"line\";\n}\n\nfunction cartesianChartFor(series: CartesianSeries[]): CartesianChartComponent {\n const types = new Set(series.map((item) => item.type));\n const firstSeries = series[0];\n\n if (firstSeries === undefined || types.size !== 1) {\n return ComposedChart;\n }\n\n switch (firstSeries.type) {\n case \"area\":\n return AreaChart;\n case \"bar\":\n return BarChart;\n case \"line\":\n return LineChart;\n }\n}\n\nfunction ChartFrame({\n children,\n description,\n id,\n title,\n}: {\n children: ReactNode;\n description: string | null;\n id?: string;\n title: string | null;\n}) {\n const hasHeader = title !== null || description !== null;\n\n return (\n <div\n className=\"flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={id}\n >\n {hasHeader && (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title !== null && <div className=\"text-sm font-semibold leading-tight\">{title}</div>}\n {description !== null && (\n <div className=\"text-xs leading-5 text-lt-muted-fg\">{description}</div>\n )}\n </div>\n )}\n {children}\n </div>\n );\n}\n\nfunction CartesianChart({ props }: { props: ChartProps }) {\n const series = props.series.filter(isCartesianSeries);\n const RechartsChart = cartesianChartFor(series);\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n const ctx = { locale, timezone };\n const formatCategory = (value: unknown) => formatValue(value, props.categoryFormat, ctx);\n const formatValueTick = (value: unknown) => formatValue(value, props.valueFormat, ctx);\n const hasBarSeries = series.some((item) => item.type === \"bar\");\n const tooltipCursor = hasBarSeries\n ? { fill: \"var(--lt-muted-fg)\", fillOpacity: 0.15 }\n : { stroke: \"var(--lt-muted-fg)\", strokeOpacity: 0.4 };\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <RechartsChart data={props.data} margin={chartMargin}>\n {props.grid && <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--lt-border)\" />}\n {props.xAxis && props.categoryKey !== null && (\n <XAxis\n dataKey={props.categoryKey}\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickFormatter={formatCategory}\n tickLine={false}\n />\n )}\n {props.yAxis && (\n <YAxis\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickFormatter={formatValueTick}\n tickLine={false}\n width={42}\n />\n )}\n {props.tooltip && (\n <Tooltip\n {...tooltipProps}\n cursor={tooltipCursor}\n formatter={formatValueTick}\n labelFormatter={formatCategory}\n />\n )}\n {props.legend && <Legend {...compactLegendProps} />}\n {series.map((item, index) => {\n const color = item.color ?? colorAt(index);\n const key = `${item.type}:${item.dataKey}`;\n\n if (item.type === \"area\") {\n return (\n <Area\n key={key}\n dataKey={item.dataKey}\n fill={color}\n fillOpacity={0.16}\n name={item.name ?? undefined}\n stackId={item.stackId ?? undefined}\n stroke={color}\n type=\"monotone\"\n />\n );\n }\n\n if (item.type === \"bar\") {\n return (\n <Bar\n key={key}\n dataKey={item.dataKey}\n fill={color}\n name={item.name ?? undefined}\n radius={[4, 4, 0, 0]}\n stackId={item.stackId ?? undefined}\n />\n );\n }\n\n return (\n <Line\n key={key}\n dataKey={item.dataKey}\n dot={false}\n name={item.name ?? undefined}\n stroke={color}\n strokeWidth={2}\n type=\"monotone\"\n />\n );\n })}\n </RechartsChart>\n </ResponsiveContainer>\n );\n}\n\nfunction PieChartView({ props, series }: { props: ChartProps; series: ChartSeries }) {\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n const ctx = { locale, timezone };\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <PieChart margin={chartMargin}>\n {props.tooltip && (\n <Tooltip\n {...tooltipProps}\n formatter={(value) => formatValue(value, props.valueFormat, ctx)}\n labelFormatter={(value) => formatValue(value, props.categoryFormat, ctx)}\n />\n )}\n {props.legend && <Legend {...compactLegendProps} />}\n <Pie\n data={props.data}\n dataKey={series.dataKey}\n name={series.name ?? undefined}\n nameKey={series.nameKey ?? undefined}\n outerRadius=\"68%\"\n >\n {props.data.map((datum, index) => (\n <Cell key={index} fill={datumColor(datum, series, index)} />\n ))}\n </Pie>\n </PieChart>\n </ResponsiveContainer>\n );\n}\n\nconst ChartComponent: RendererComponent<\"chart\"> = ({ node }) => {\n const props = node.props;\n const pieSeries = props.series.find((series) => series.type === \"pie\");\n const hasCartesianSeries = props.series.some(isCartesianSeries);\n\n return (\n <ChartFrame description={props.description} id={nodeIdentity(node)} title={props.title}>\n <div className=\"min-h-0 w-full\">\n {pieSeries && !hasCartesianSeries ? (\n <PieChartView props={props} series={pieSeries} />\n ) : (\n <CartesianChart props={props} />\n )}\n </div>\n </ChartFrame>\n );\n};\n\nexport default ChartComponent;\n"],"mappings":";;;;;;;AAmCA,IAAM,cAA2B;CAAE,QAAQ;CAAG,MAAM;CAAG,OAAO;CAAI,KAAK;AAAE;AACzE,IAAM,qBAAqB;CACzB,OAAO;CACP,QAAQ;CACR,UAAU;CACV,eAAe;CACf,cAAc;EAAE,UAAU;EAAI,YAAY;EAAQ,eAAe;CAAE;AACrE;AACA,IAAM,WAAW,EAAE,UAAU,GAAG;AAChC,IAAM,eAAe;CACnB,cAAc;EACZ,YAAY;EACZ,QAAQ;EACR,cAAc;EACd,WAAW;EACX,OAAO;EACP,UAAU;CACZ;CACA,WAAW,EAAE,OAAO,uBAAuB;CAC3C,YAAY,EAAE,OAAO,qBAAqB;AAC5C;AAEA,IAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,QAAQ,QAAQ,WAAW;AAC5C;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAW,OAAmB,QAAqB,OAAuB;CACjF,IAAI,SAAS,KAAK,KAAK,OAAO,MAAM,UAAU,UAC5C,OAAO,MAAM;CAGf,OAAO,OAAO,SAAS,QAAQ,KAAK;AACtC;AAEA,SAAS,kBAAkB,QAAgD;CACzE,OAAO,OAAO,SAAS,UAAU,OAAO,SAAS,SAAS,OAAO,SAAS;AAC5E;AAEA,SAAS,kBAAkB,QAAoD;CAC7E,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,SAAS,KAAK,IAAI,CAAC;CACrD,MAAM,cAAc,OAAO;CAE3B,IAAI,gBAAgB,KAAA,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,YAAY,OAAO,MAAM,aAAa,GAAG;KAC/D,iBAAiB,UAAU,YAAY,OAAO,MAAM,gBAAgB,GAAG;IACxE,CAAA;IAEF,MAAM,UAAU,oBAAC,QAAD,EAAQ,GAAI,mBAAqB,CAAA;IAClD,oBAAC,KAAD;KACE,MAAM,MAAM;KACZ,SAAS,OAAO;KAChB,MAAM,OAAO,QAAQ,KAAA;KACrB,SAAS,OAAO,WAAW,KAAA;KAC3B,aAAY;eAEX,MAAM,KAAK,KAAK,OAAO,UACtB,oBAAC,MAAD,EAAkB,MAAM,WAAW,OAAO,QAAQ,KAAK,EAAI,GAAhD,KAAgD,CAC5D;IACE,CAAA;GACG;;CACS,CAAA;AAEzB;AAEA,IAAM,kBAA8C,EAAE,WAAW;CAC/D,MAAM,QAAQ,KAAK;CACnB,MAAM,YAAY,MAAM,OAAO,MAAM,WAAW,OAAO,SAAS,KAAK;CACrE,MAAM,qBAAqB,MAAM,OAAO,KAAK,iBAAiB;CAE9D,OACE,oBAAC,YAAD;EAAY,aAAa,MAAM;EAAa,IAAI,aAAa,IAAI;EAAG,OAAO,MAAM;YAC/E,oBAAC,OAAD;GAAK,WAAU;aACZ,aAAa,CAAC,qBACb,oBAAC,cAAD;IAAqB;IAAO,QAAQ;GAAY,CAAA,IAEhD,oBAAC,gBAAD,EAAuB,MAAQ,CAAA;EAE9B,CAAA;CACK,CAAA;AAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","names":[],"sources":["../../../resources/js/core/components/collapsible.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Icon } from \"@lattice-php/lattice/icons\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { nodeIdentity, prefixedTestId } from \"@lattice-php/lattice/core/test-id\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction readStored(key: string, remember: boolean, fallback: boolean): boolean {\n if (!remember || typeof window === \"undefined\") {\n return fallback;\n }\n\n const stored = window.localStorage.getItem(key);\n\n return stored === null ? fallback : stored === \"true\";\n}\n\nconst CollapsibleComponent: RendererComponent<\"collapsible\"> = ({ children, node }) => {\n const rememberState = node.props.rememberState === true;\n const trigger = toNodes(node.props.trigger);\n const identity = nodeIdentity(node);\n const storageKey = `lattice:collapsible:${identity ?? \"default\"}`;\n const contentId = `${identity ?? \"collapsible\"}-content`;\n\n const [open, setOpen] = useState(() =>\n readStored(storageKey, rememberState, node.props.collapsed === false),\n );\n\n function toggle(): void {\n setOpen((value) => {\n const next = !value;\n\n if (rememberState && typeof window !== \"undefined\") {\n window.localStorage.setItem(storageKey, String(next));\n }\n\n return next;\n });\n }\n\n return (\n <div data-lattice-component={identity}>\n <div\n aria-controls={contentId}\n aria-expanded={open}\n data-test={prefixedTestId(\"collapsible-toggle\", identity) ?? \"collapsible-toggle-default\"}\n className=\"flex w-full cursor-pointer items-center justify-between gap-4 rounded-lt-sm py-2 text-left text-lt-fg transition-colors hover:bg-lt-muted\"\n onClick={toggle}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n toggle();\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n <Renderer nodes={trigger} />\n {node.props.tooltip && (\n <span\n role=\"presentation\"\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n >\n <InfoTooltip content={node.props.tooltip} />\n </span>\n )}\n </div>\n <Icon\n name=\"chevron-down\"\n className={cn(\n \"size-lt-icon-md shrink-0 text-lt-muted-fg transition-transform\",\n !open && \"-rotate-90\",\n )}\n />\n </div>\n\n {open && children && (\n <div id={contentId} className=\"flex flex-col gap-4 pt-2\">\n {children}\n </div>\n )}\n </div>\n );\n};\n\nexport default CollapsibleComponent;\n"],"mappings":";;;;;;;;;AASA,SAAS,WAAW,KAAa,UAAmB,UAA4B;CAC9E,IAAI,CAAC,YAAY,OAAO,WAAW,aACjC,OAAO;CAGT,MAAM,SAAS,OAAO,aAAa,QAAQ,GAAG;CAE9C,OAAO,WAAW,OAAO,WAAW,WAAW;AACjD;AAEA,IAAM,wBAA0D,EAAE,UAAU,WAAW;CACrF,MAAM,gBAAgB,KAAK,MAAM,kBAAkB;CACnD,MAAM,UAAU,QAAQ,KAAK,MAAM,OAAO;CAC1C,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,aAAa,uBAAuB,YAAY;CACtD,MAAM,YAAY,GAAG,YAAY,cAAc;CAE/C,MAAM,CAAC,MAAM,WAAW,eACtB,WAAW,YAAY,eAAe,KAAK,MAAM,cAAc,KAAK,CACtE;CAEA,SAAS,SAAe;EACtB,SAAS,UAAU;GACjB,MAAM,OAAO,CAAC;GAEd,IAAI,iBAAiB,OAAO,WAAW,aACrC,OAAO,aAAa,QAAQ,YAAY,OAAO,IAAI,CAAC;GAGtD,OAAO;EACT,CAAC;CACH;CAEA,OACE,qBAAC,OAAD;EAAK,0BAAwB;
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":[],"sources":["../../../resources/js/core/components/collapsible.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Icon } from \"@lattice-php/lattice/icons\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { nodeIdentity, prefixedTestId } from \"@lattice-php/lattice/core/test-id\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction readStored(key: string, remember: boolean, fallback: boolean): boolean {\n if (!remember || typeof window === \"undefined\") {\n return fallback;\n }\n\n const stored = window.localStorage.getItem(key);\n\n return stored === null ? fallback : stored === \"true\";\n}\n\nconst CollapsibleComponent: RendererComponent<\"collapsible\"> = ({ children, node }) => {\n const rememberState = node.props.rememberState === true;\n const trigger = toNodes(node.props.trigger);\n const identity = nodeIdentity(node);\n const storageKey = `lattice:collapsible:${identity ?? \"default\"}`;\n const contentId = `${identity ?? \"collapsible\"}-content`;\n\n const [open, setOpen] = useState(() =>\n readStored(storageKey, rememberState, node.props.collapsed === false),\n );\n\n function toggle(): void {\n setOpen((value) => {\n const next = !value;\n\n if (rememberState && typeof window !== \"undefined\") {\n window.localStorage.setItem(storageKey, String(next));\n }\n\n return next;\n });\n }\n\n return (\n <div data-slot=\"collapsible\" data-lattice-component={identity}>\n <div\n aria-controls={contentId}\n aria-expanded={open}\n data-test={prefixedTestId(\"collapsible-toggle\", identity) ?? \"collapsible-toggle-default\"}\n className=\"flex w-full cursor-pointer items-center justify-between gap-4 rounded-lt-sm py-2 text-left text-lt-fg transition-colors hover:bg-lt-muted\"\n onClick={toggle}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n toggle();\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n <Renderer nodes={trigger} />\n {node.props.tooltip && (\n <span\n role=\"presentation\"\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n >\n <InfoTooltip content={node.props.tooltip} />\n </span>\n )}\n </div>\n <Icon\n name=\"chevron-down\"\n className={cn(\n \"size-lt-icon-md shrink-0 text-lt-muted-fg transition-transform\",\n !open && \"-rotate-90\",\n )}\n />\n </div>\n\n {open && children && (\n <div id={contentId} className=\"flex flex-col gap-4 pt-2\">\n {children}\n </div>\n )}\n </div>\n );\n};\n\nexport default CollapsibleComponent;\n"],"mappings":";;;;;;;;;AASA,SAAS,WAAW,KAAa,UAAmB,UAA4B;CAC9E,IAAI,CAAC,YAAY,OAAO,WAAW,aACjC,OAAO;CAGT,MAAM,SAAS,OAAO,aAAa,QAAQ,GAAG;CAE9C,OAAO,WAAW,OAAO,WAAW,WAAW;AAC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7,6 +7,6 @@ export declare const FOCUS_RING = "focus-visible:border-lt-ring focus-visible:ri
|
|
|
7
7
|
* border, focus ring, invalid, and disabled treatment are unified.
|
|
8
8
|
*/
|
|
9
9
|
export declare const controlSurface: (props?: ({
|
|
10
|
-
density?: "
|
|
10
|
+
density?: "compact" | "comfortable" | null | undefined;
|
|
11
11
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
12
12
|
export type ControlSurfaceVariants = VariantProps<typeof controlSurface>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
export declare const DIALOG_SURFACE = "fixed left-1/2 top-1/2 z-
|
|
3
|
+
export declare const DIALOG_SURFACE = "fixed left-1/2 top-1/2 z-lt-modal -translate-x-1/2 -translate-y-1/2 rounded-lt border border-lt-border bg-lt-bg p-6 shadow-lt-lg";
|
|
4
4
|
declare function Dialog(props: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
5
5
|
declare function DialogClose(props: React.ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
6
6
|
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
|
|
@@ -5,7 +5,7 @@ import "react";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
7
7
|
//#region resources/js/core/components/dialog.tsx
|
|
8
|
-
var DIALOG_SURFACE = "fixed left-1/2 top-1/2 z-
|
|
8
|
+
var DIALOG_SURFACE = "fixed left-1/2 top-1/2 z-lt-modal -translate-x-1/2 -translate-y-1/2 rounded-lt border border-lt-border bg-lt-bg p-6 shadow-lt-lg";
|
|
9
9
|
function Dialog(props) {
|
|
10
10
|
return /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
11
11
|
"data-slot": "dialog",
|
|
@@ -34,7 +34,7 @@ function DialogDescription({ className, ...props }) {
|
|
|
34
34
|
}
|
|
35
35
|
function DialogContent({ children, className, ...props }) {
|
|
36
36
|
return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [/* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
37
|
-
className: "fixed inset-0 z-
|
|
37
|
+
className: "fixed inset-0 z-lt-overlay bg-lt-overlay",
|
|
38
38
|
"data-slot": "dialog-overlay"
|
|
39
39
|
}), /* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
40
40
|
className: cn(DIALOG_SURFACE, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":[],"sources":["../../../resources/js/core/components/dialog.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { Button } from \"@lattice-php/lattice/core/components/button\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nexport const DIALOG_SURFACE =\n \"fixed left-1/2 top-1/2 z-
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../resources/js/core/components/dialog.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { Button } from \"@lattice-php/lattice/core/components/button\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nexport const DIALOG_SURFACE =\n \"fixed left-1/2 top-1/2 z-lt-modal -translate-x-1/2 -translate-y-1/2 rounded-lt border border-lt-border bg-lt-bg p-6 shadow-lt-lg\";\n\nfunction Dialog(props: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogClose(props: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n data-slot=\"dialog-title\"\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n className={cn(\"text-sm text-lt-muted-fg\", className)}\n data-slot=\"dialog-description\"\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n children,\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content>) {\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay\n className=\"fixed inset-0 z-lt-overlay bg-lt-overlay\"\n data-slot=\"dialog-overlay\"\n />\n <DialogPrimitive.Content\n className={cn(DIALOG_SURFACE, className)}\n data-slot=\"dialog-content\"\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n}\n\n/**\n * The shared dialog header: a title with an optional description and a ghost\n * close button. Pass `description` as `undefined` to suppress the description\n * and the matching `aria-describedby` wiring on the content.\n */\nfunction DialogHeader({\n closeLabel,\n description,\n title,\n}: {\n closeLabel?: string;\n description?: React.ReactNode;\n title: React.ReactNode;\n}) {\n return (\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"grid gap-2\">\n <DialogTitle>{title}</DialogTitle>\n {description ? <DialogDescription>{description}</DialogDescription> : null}\n </div>\n <DialogClose asChild>\n <Button aria-label={closeLabel} data-test=\"dialog-close\" size=\"icon\" variant=\"ghost\">\n <Icon name=\"x\" aria-hidden=\"true\" className=\"size-lt-icon-md\" />\n </Button>\n </DialogClose>\n </div>\n );\n}\n\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle };\n"],"mappings":";;;;;;;AAMA,IAAa,iBACX;AAEF,SAAS,OAAO,OAA0D;CACxE,OAAO,oBAAC,gBAAgB,MAAjB;EAAsB,aAAU;EAAS,GAAI;CAAQ,CAAA;AAC9D;AAEA,SAAS,YAAY,OAA2D;CAC9E,OAAO,oBAAC,gBAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA6D;CAChG,OACE,oBAAC,gBAAgB,OAAjB;EACE,WAAW,GAAG,qDAAqD,SAAS;EAC5E,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAAC,gBAAgB,aAAjB;EACE,WAAW,GAAG,4BAA4B,SAAS;EACnD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,UACA,WACA,GAAG,SACoD;CACvD,OACE,qBAAC,gBAAgB,QAAjB,EAAA,UAAA,CACE,oBAAC,gBAAgB,SAAjB;EACE,WAAU;EACV,aAAU;CACX,CAAA,GACD,oBAAC,gBAAgB,SAAjB;EACE,WAAW,GAAG,gBAAgB,SAAS;EACvC,aAAU;EACV,GAAI;EAEH;CACsB,CAAA,CACH,EAAA,CAAA;AAE5B;;;;;;AAOA,SAAS,aAAa,EACpB,YACA,aACA,SAKC;CACD,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,aAAD,EAAA,UAAc,MAAmB,CAAA,GAChC,cAAc,oBAAC,mBAAD,EAAA,UAAoB,YAA+B,CAAA,IAAI,IACnE;MACL,oBAAC,aAAD;GAAa,SAAA;aACX,oBAAC,QAAD;IAAQ,cAAY;IAAY,aAAU;IAAe,MAAK;IAAO,SAAQ;cAC3E,oBAAC,MAAD;KAAM,MAAK;KAAI,eAAY;KAAO,WAAU;IAAmB,CAAA;GACzD,CAAA;EACG,CAAA,CACV;;AAET"}
|
|
@@ -30,7 +30,7 @@ var FloatingPanelComponent = ({ children, node }) => {
|
|
|
30
30
|
const [open, setOpen] = useState(false);
|
|
31
31
|
if (trigger.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
32
32
|
"aria-label": label,
|
|
33
|
-
className: "fixed z-
|
|
33
|
+
className: "fixed z-lt-popover max-w-[calc(100vw-2rem)] rounded-lt border border-lt-border bg-lt-popover p-1 text-lt-popover-fg shadow-lt-md",
|
|
34
34
|
"data-lattice-component": nodeIdentity(node),
|
|
35
35
|
role: label ? "group" : void 0,
|
|
36
36
|
style: placementStyle(placement, offset),
|
|
@@ -40,7 +40,7 @@ var FloatingPanelComponent = ({ children, node }) => {
|
|
|
40
40
|
const anchorsToStart = placement === "top-start" || placement === "bottom-start";
|
|
41
41
|
return /* @__PURE__ */ jsx("div", {
|
|
42
42
|
"aria-label": label,
|
|
43
|
-
className: "fixed z-
|
|
43
|
+
className: "fixed z-lt-popover max-w-[calc(100vw-2rem)]",
|
|
44
44
|
"data-lattice-component": nodeIdentity(node),
|
|
45
45
|
role: label ? "group" : void 0,
|
|
46
46
|
style: placementStyle(placement, offset),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-panel.js","names":[],"sources":["../../../resources/js/core/components/floating-panel.tsx"],"sourcesContent":["import { type CSSProperties, useState } from \"react\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport type { FloatingPlacement } from \"@lattice-php/lattice/types/generated\";\nimport { RenderNode } from \"@lattice-php/lattice/core/renderer\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction placementStyle(placement: FloatingPlacement, offset: number): CSSProperties {\n if (placement === \"top-start\") {\n return { left: offset, top: offset };\n }\n\n if (placement === \"top-end\") {\n return { right: offset, top: offset };\n }\n\n if (placement === \"bottom-start\") {\n return { bottom: offset, left: offset };\n }\n\n return { bottom: offset, right: offset };\n}\n\nconst FloatingPanelComponent: RendererComponent<\"floating-panel\"> = ({ children, node }) => {\n const label = node.props.label ?? undefined;\n const offset = Math.max(0, node.props.offset ?? 16);\n const placement = node.props.placement ?? \"bottom-end\";\n const trigger = node.props.trigger ?? [];\n const [open, setOpen] = useState(false);\n\n if (trigger.length === 0) {\n return (\n <div\n aria-label={label}\n className=\"fixed z-
|
|
1
|
+
{"version":3,"file":"floating-panel.js","names":[],"sources":["../../../resources/js/core/components/floating-panel.tsx"],"sourcesContent":["import { type CSSProperties, useState } from \"react\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport type { FloatingPlacement } from \"@lattice-php/lattice/types/generated\";\nimport { RenderNode } from \"@lattice-php/lattice/core/renderer\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction placementStyle(placement: FloatingPlacement, offset: number): CSSProperties {\n if (placement === \"top-start\") {\n return { left: offset, top: offset };\n }\n\n if (placement === \"top-end\") {\n return { right: offset, top: offset };\n }\n\n if (placement === \"bottom-start\") {\n return { bottom: offset, left: offset };\n }\n\n return { bottom: offset, right: offset };\n}\n\nconst FloatingPanelComponent: RendererComponent<\"floating-panel\"> = ({ children, node }) => {\n const label = node.props.label ?? undefined;\n const offset = Math.max(0, node.props.offset ?? 16);\n const placement = node.props.placement ?? \"bottom-end\";\n const trigger = node.props.trigger ?? [];\n const [open, setOpen] = useState(false);\n\n if (trigger.length === 0) {\n return (\n <div\n aria-label={label}\n className=\"fixed z-lt-popover max-w-[calc(100vw-2rem)] rounded-lt border border-lt-border bg-lt-popover p-1 text-lt-popover-fg shadow-lt-md\"\n data-lattice-component={nodeIdentity(node)}\n role={label ? \"group\" : undefined}\n style={placementStyle(placement, offset)}\n >\n {children}\n </div>\n );\n }\n\n const expandsUpward = placement === \"bottom-start\" || placement === \"bottom-end\";\n const anchorsToStart = placement === \"top-start\" || placement === \"bottom-start\";\n\n return (\n <div\n aria-label={label}\n className=\"fixed z-lt-popover max-w-[calc(100vw-2rem)]\"\n data-lattice-component={nodeIdentity(node)}\n role={label ? \"group\" : undefined}\n style={placementStyle(placement, offset)}\n >\n <div className={cn(\"flex w-fit gap-2\", expandsUpward ? \"flex-col-reverse\" : \"flex-col\")}>\n <button\n aria-expanded={open}\n className={cn(\n \"inline-flex items-center gap-2 rounded-lt border border-lt-border bg-lt-popover px-3 py-1.5 text-sm font-medium text-lt-popover-fg shadow-lt-md hover:bg-lt-muted\",\n anchorsToStart ? \"self-start\" : \"self-end\",\n )}\n data-test={node.key ? `${node.key}-trigger` : undefined}\n onClick={() => setOpen((value) => !value)}\n type=\"button\"\n >\n {trigger.map((triggerNode, index) => (\n <RenderNode\n key={triggerNode.key ?? `${triggerNode.type}-${index}`}\n node={triggerNode}\n />\n ))}\n </button>\n <div className={open ? \"block\" : \"hidden\"}>{children}</div>\n </div>\n </div>\n );\n};\n\nexport default FloatingPanelComponent;\n"],"mappings":";;;;;;AAOA,SAAS,eAAe,WAA8B,QAA+B;CACnF,IAAI,cAAc,aAChB,OAAO;EAAE,MAAM;EAAQ,KAAK;CAAO;CAGrC,IAAI,cAAc,WAChB,OAAO;EAAE,OAAO;EAAQ,KAAK;CAAO;CAGtC,IAAI,cAAc,gBAChB,OAAO;EAAE,QAAQ;EAAQ,MAAM;CAAO;CAGxC,OAAO;EAAE,QAAQ;EAAQ,OAAO;CAAO;AACzC;AAEA,IAAM,0BAA+D,EAAE,UAAU,WAAW;CAC1F,MAAM,QAAQ,KAAK,MAAM,SAAS,KAAA;CAClC,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,MAAM,UAAU,EAAE;CAClD,MAAM,YAAY,KAAK,MAAM,aAAa;CAC1C,MAAM,UAAU,KAAK,MAAM,WAAW,CAAC;CACvC,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAEtC,IAAI,QAAQ,WAAW,GACrB,OACE,oBAAC,OAAD;EACE,cAAY;EACZ,WAAU;EACV,0BAAwB,aAAa,IAAI;EACzC,MAAM,QAAQ,UAAU,KAAA;EACxB,OAAO,eAAe,WAAW,MAAM;EAEtC;CACE,CAAA;CAIT,MAAM,gBAAgB,cAAc,kBAAkB,cAAc;CACpE,MAAM,iBAAiB,cAAc,eAAe,cAAc;CAElE,OACE,oBAAC,OAAD;EACE,cAAY;EACZ,WAAU;EACV,0BAAwB,aAAa,IAAI;EACzC,MAAM,QAAQ,UAAU,KAAA;EACxB,OAAO,eAAe,WAAW,MAAM;YAEvC,qBAAC,OAAD;GAAK,WAAW,GAAG,oBAAoB,gBAAgB,qBAAqB,UAAU;aAAtF,CACE,oBAAC,UAAD;IACE,iBAAe;IACf,WAAW,GACT,qKACA,iBAAiB,eAAe,UAClC;IACA,aAAW,KAAK,MAAM,GAAG,KAAK,IAAI,YAAY,KAAA;IAC9C,eAAe,SAAS,UAAU,CAAC,KAAK;IACxC,MAAK;cAEJ,QAAQ,KAAK,aAAa,UACzB,oBAAC,YAAD,EAEE,MAAM,YACP,GAFM,YAAY,OAAO,GAAG,YAAY,KAAK,GAAG,OAEhD,CACF;GACK,CAAA,GACR,oBAAC,OAAD;IAAK,WAAW,OAAO,UAAU;IAAW;GAAc,CAAA,CACvD;;CACF,CAAA;AAET"}
|
|
@@ -5,6 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
var GridComponent = ({ children, node }) => {
|
|
6
6
|
const columns = Math.min(Math.max(node.props.columns ?? 1, 1), 4);
|
|
7
7
|
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
"data-slot": "grid",
|
|
8
9
|
"data-lattice-component": nodeIdentity(node),
|
|
9
10
|
className: cn("grid gap-x-4 gap-y-6", columns >= 2 && "md:grid-cols-2", columns >= 3 && "lg:grid-cols-3", columns >= 4 && "xl:grid-cols-4"),
|
|
10
11
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","names":[],"sources":["../../../resources/js/core/components/grid.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\n\nconst GridComponent: RendererComponent<\"grid\"> = ({ children, node }) => {\n const columns = Math.min(Math.max(node.props.columns ?? 1, 1), 4);\n\n return (\n <div\n data-lattice-component={nodeIdentity(node)}\n className={cn(\n \"grid gap-x-4 gap-y-6\",\n columns >= 2 && \"md:grid-cols-2\",\n columns >= 3 && \"lg:grid-cols-3\",\n columns >= 4 && \"xl:grid-cols-4\",\n )}\n >\n {children}\n </div>\n );\n};\n\nexport default GridComponent;\n"],"mappings":";;;;AAIA,IAAM,iBAA4C,EAAE,UAAU,WAAW;CACvE,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,KAAK,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC;CAEhE,OACE,oBAAC,OAAD;EACE,0BAAwB,aAAa,IAAI;EACzC,WAAW,GACT,wBACA,WAAW,KAAK,kBAChB,WAAW,KAAK,kBAChB,WAAW,KAAK,gBAClB;EAEC;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"grid.js","names":[],"sources":["../../../resources/js/core/components/grid.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\n\nconst GridComponent: RendererComponent<\"grid\"> = ({ children, node }) => {\n const columns = Math.min(Math.max(node.props.columns ?? 1, 1), 4);\n\n return (\n <div\n data-slot=\"grid\"\n data-lattice-component={nodeIdentity(node)}\n className={cn(\n \"grid gap-x-4 gap-y-6\",\n columns >= 2 && \"md:grid-cols-2\",\n columns >= 3 && \"lg:grid-cols-3\",\n columns >= 4 && \"xl:grid-cols-4\",\n )}\n >\n {children}\n </div>\n );\n};\n\nexport default GridComponent;\n"],"mappings":";;;;AAIA,IAAM,iBAA4C,EAAE,UAAU,WAAW;CACvE,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,KAAK,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC;CAEhE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,0BAAwB,aAAa,IAAI;EACzC,WAAW,GACT,wBACA,WAAW,KAAK,kBAChB,WAAW,KAAK,kBAChB,WAAW,KAAK,gBAClB;EAEC;CACE,CAAA;AAET"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { IconRenderer } from "../../icons/icon-renderer.js";
|
|
2
3
|
import { nodeIdentity } from "../test-id.js";
|
|
3
4
|
import { useAction } from "../../action/use-action.js";
|
|
4
5
|
import { actionMenuItemClassName, useActionMenu } from "../../action/components/action-menu-context.js";
|
|
@@ -13,9 +14,10 @@ function TextLink({ className = "", children, ...props }) {
|
|
|
13
14
|
children
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
function ActionLink({ action, className, children, testId }) {
|
|
17
|
+
function ActionLink({ action, ariaLabel, className, children, testId }) {
|
|
17
18
|
const { processing, requestSubmit, overlays } = useAction(action);
|
|
18
19
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
|
|
20
|
+
"aria-label": ariaLabel,
|
|
19
21
|
className: cn(textLinkClassName, className),
|
|
20
22
|
"data-test": testId,
|
|
21
23
|
disabled: processing,
|
|
@@ -24,22 +26,78 @@ function ActionLink({ action, className, children, testId }) {
|
|
|
24
26
|
children
|
|
25
27
|
}), overlays] });
|
|
26
28
|
}
|
|
29
|
+
function LinkAffix({ affix, className }) {
|
|
30
|
+
if (affix.icon) return /* @__PURE__ */ jsx(IconRenderer, {
|
|
31
|
+
className: cn("size-lt-icon-md shrink-0", className),
|
|
32
|
+
icon: affix.icon
|
|
33
|
+
});
|
|
34
|
+
return /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: cn("shrink-0 text-sm text-lt-muted-fg", className),
|
|
36
|
+
children: affix.text
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function LinkContent({ icon, isMenuItem, label, prefix, suffix }) {
|
|
40
|
+
if (icon) return /* @__PURE__ */ jsx(IconRenderer, {
|
|
41
|
+
className: "size-lt-icon-md shrink-0",
|
|
42
|
+
icon
|
|
43
|
+
});
|
|
44
|
+
if (isMenuItem) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
prefix ? /* @__PURE__ */ jsx(LinkAffix, { affix: prefix }) : null,
|
|
46
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
47
|
+
suffix ? /* @__PURE__ */ jsx(LinkAffix, {
|
|
48
|
+
affix: suffix,
|
|
49
|
+
className: "ml-auto"
|
|
50
|
+
}) : null
|
|
51
|
+
] });
|
|
52
|
+
if (prefix || suffix) return /* @__PURE__ */ jsxs("span", {
|
|
53
|
+
className: "inline-flex items-center gap-1.5 align-baseline",
|
|
54
|
+
children: [
|
|
55
|
+
prefix ? /* @__PURE__ */ jsx(LinkAffix, { affix: prefix }) : null,
|
|
56
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
57
|
+
suffix ? /* @__PURE__ */ jsx(LinkAffix, { affix: suffix }) : null
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
return label;
|
|
61
|
+
}
|
|
62
|
+
function labelWithTextAffixes(label, prefix, suffix) {
|
|
63
|
+
if (!prefix?.text && !suffix?.text) return;
|
|
64
|
+
return [
|
|
65
|
+
prefix?.text,
|
|
66
|
+
label,
|
|
67
|
+
suffix?.text
|
|
68
|
+
].filter((part) => Boolean(part)).join(" ");
|
|
69
|
+
}
|
|
27
70
|
var LinkComponent = ({ node }) => {
|
|
28
71
|
const isMenuItem = useActionMenu();
|
|
29
72
|
const action = node.props.action;
|
|
73
|
+
const icon = node.props.icon;
|
|
74
|
+
const label = node.props.label;
|
|
75
|
+
const prefix = node.props.prefix;
|
|
76
|
+
const suffix = node.props.suffix;
|
|
77
|
+
const iconOnly = Boolean(icon);
|
|
78
|
+
const content = /* @__PURE__ */ jsx(LinkContent, {
|
|
79
|
+
icon,
|
|
80
|
+
isMenuItem,
|
|
81
|
+
label,
|
|
82
|
+
prefix,
|
|
83
|
+
suffix
|
|
84
|
+
});
|
|
85
|
+
const ariaLabel = iconOnly ? label : labelWithTextAffixes(label, prefix, suffix);
|
|
30
86
|
if (action) return /* @__PURE__ */ jsx(ActionLink, {
|
|
31
87
|
action,
|
|
88
|
+
ariaLabel,
|
|
32
89
|
className: isMenuItem ? actionMenuItemClassName : void 0,
|
|
33
90
|
testId: nodeIdentity(node),
|
|
34
|
-
children:
|
|
91
|
+
children: content
|
|
35
92
|
});
|
|
36
93
|
return /* @__PURE__ */ jsx(TextLink, {
|
|
94
|
+
"aria-label": ariaLabel,
|
|
37
95
|
className: isMenuItem ? actionMenuItemClassName : void 0,
|
|
38
96
|
"data-test": nodeIdentity(node),
|
|
39
97
|
href: node.props.href ?? "#",
|
|
40
98
|
method: node.props.method ?? "get",
|
|
41
99
|
tabIndex: node.props.tabIndex ?? void 0,
|
|
42
|
-
children:
|
|
100
|
+
children: content
|
|
43
101
|
});
|
|
44
102
|
};
|
|
45
103
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","names":[],"sources":["../../../resources/js/core/components/link.tsx"],"sourcesContent":["import { Link } from \"@inertiajs/react\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { useAction } from \"@lattice-php/lattice/action/use-action\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { Node, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport {\n actionMenuItemClassName,\n useActionMenu,\n} from \"@lattice-php/lattice/action/components/action-menu-context\";\n\nconst textLinkClassName =\n \"text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border\";\n\nfunction TextLink({ className = \"\", children, ...props }: ComponentProps<typeof Link>) {\n return (\n <Link className={cn(textLinkClassName, className)} {...props}>\n {children}\n </Link>\n );\n}\n\nfunction ActionLink({\n action,\n className,\n children,\n testId,\n}: {\n action: Node<\"action\">;\n className?: string;\n children: ReactNode;\n testId?: string;\n}) {\n const { processing, requestSubmit, overlays } = useAction(action);\n\n return (\n <>\n <button\n className={cn(textLinkClassName, className)}\n data-test={testId}\n disabled={processing}\n onClick={requestSubmit}\n type=\"button\"\n >\n {children}\n </button>\n {overlays}\n </>\n );\n}\n\nconst LinkComponent: RendererComponent<\"link\"> = ({ node }) => {\n const isMenuItem = useActionMenu();\n const action = node.props.action;\n\n if (action) {\n return (\n <ActionLink\n action={action as Node<\"action\">}\n className={isMenuItem ? actionMenuItemClassName : undefined}\n testId={nodeIdentity(node)}\n >\n {
|
|
1
|
+
{"version":3,"file":"link.js","names":[],"sources":["../../../resources/js/core/components/link.tsx"],"sourcesContent":["import { Link } from \"@inertiajs/react\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { useAction } from \"@lattice-php/lattice/action/use-action\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { Node, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport type { Affix } from \"@lattice-php/lattice/types/generated\";\nimport {\n actionMenuItemClassName,\n useActionMenu,\n} from \"@lattice-php/lattice/action/components/action-menu-context\";\n\nconst textLinkClassName =\n \"text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border\";\n\nfunction TextLink({ className = \"\", children, ...props }: ComponentProps<typeof Link>) {\n return (\n <Link className={cn(textLinkClassName, className)} {...props}>\n {children}\n </Link>\n );\n}\n\nfunction ActionLink({\n action,\n ariaLabel,\n className,\n children,\n testId,\n}: {\n action: Node<\"action\">;\n ariaLabel?: string;\n className?: string;\n children: ReactNode;\n testId?: string;\n}) {\n const { processing, requestSubmit, overlays } = useAction(action);\n\n return (\n <>\n <button\n aria-label={ariaLabel}\n className={cn(textLinkClassName, className)}\n data-test={testId}\n disabled={processing}\n onClick={requestSubmit}\n type=\"button\"\n >\n {children}\n </button>\n {overlays}\n </>\n );\n}\n\nfunction LinkAffix({ affix, className }: { affix: Affix; className?: string }) {\n if (affix.icon) {\n return <IconRenderer className={cn(\"size-lt-icon-md shrink-0\", className)} icon={affix.icon} />;\n }\n\n return <span className={cn(\"shrink-0 text-sm text-lt-muted-fg\", className)}>{affix.text}</span>;\n}\n\nfunction LinkContent({\n icon,\n isMenuItem,\n label,\n prefix,\n suffix,\n}: {\n icon?: string | null;\n isMenuItem: boolean;\n label: string;\n prefix?: Affix | null;\n suffix?: Affix | null;\n}) {\n if (icon) {\n return <IconRenderer className=\"size-lt-icon-md shrink-0\" icon={icon} />;\n }\n\n if (isMenuItem) {\n return (\n <>\n {prefix ? <LinkAffix affix={prefix} /> : null}\n <span>{label}</span>\n {suffix ? <LinkAffix affix={suffix} className=\"ml-auto\" /> : null}\n </>\n );\n }\n\n if (prefix || suffix) {\n return (\n <span className=\"inline-flex items-center gap-1.5 align-baseline\">\n {prefix ? <LinkAffix affix={prefix} /> : null}\n <span>{label}</span>\n {suffix ? <LinkAffix affix={suffix} /> : null}\n </span>\n );\n }\n\n return label;\n}\n\nfunction labelWithTextAffixes(label: string, prefix?: Affix | null, suffix?: Affix | null) {\n if (!prefix?.text && !suffix?.text) {\n return undefined;\n }\n\n return [prefix?.text, label, suffix?.text]\n .filter((part): part is string => Boolean(part))\n .join(\" \");\n}\n\nconst LinkComponent: RendererComponent<\"link\"> = ({ node }) => {\n const isMenuItem = useActionMenu();\n const action = node.props.action;\n const icon = node.props.icon;\n const label = node.props.label;\n const prefix = node.props.prefix;\n const suffix = node.props.suffix;\n const iconOnly = Boolean(icon);\n const content = (\n <LinkContent\n icon={icon}\n isMenuItem={isMenuItem}\n label={label}\n prefix={prefix}\n suffix={suffix}\n />\n );\n const ariaLabel = iconOnly ? label : labelWithTextAffixes(label, prefix, suffix);\n\n if (action) {\n return (\n <ActionLink\n action={action as Node<\"action\">}\n ariaLabel={ariaLabel}\n className={isMenuItem ? actionMenuItemClassName : undefined}\n testId={nodeIdentity(node)}\n >\n {content}\n </ActionLink>\n );\n }\n\n return (\n <TextLink\n aria-label={ariaLabel}\n className={isMenuItem ? actionMenuItemClassName : undefined}\n data-test={nodeIdentity(node)}\n href={node.props.href ?? \"#\"}\n method={node.props.method ?? \"get\"}\n tabIndex={node.props.tabIndex ?? undefined}\n >\n {content}\n </TextLink>\n );\n};\n\nexport default LinkComponent;\nexport { TextLink };\n"],"mappings":";;;;;;;;AAaA,IAAM,oBACJ;AAEF,SAAS,SAAS,EAAE,YAAY,IAAI,UAAU,GAAG,SAAsC;CACrF,OACE,oBAAC,MAAD;EAAM,WAAW,GAAG,mBAAmB,SAAS;EAAG,GAAI;EACpD;CACG,CAAA;AAEV;AAEA,SAAS,WAAW,EAClB,QACA,WACA,WACA,UACA,UAOC;CACD,MAAM,EAAE,YAAY,eAAe,aAAa,UAAU,MAAM;CAEhE,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EACE,cAAY;EACZ,WAAW,GAAG,mBAAmB,SAAS;EAC1C,aAAW;EACX,UAAU;EACV,SAAS;EACT,MAAK;EAEJ;CACK,CAAA,GACP,QACD,EAAA,CAAA;AAEN;AAEA,SAAS,UAAU,EAAE,OAAO,aAAmD;CAC7E,IAAI,MAAM,MACR,OAAO,oBAAC,cAAD;EAAc,WAAW,GAAG,4BAA4B,SAAS;EAAG,MAAM,MAAM;CAAO,CAAA;CAGhG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,qCAAqC,SAAS;YAAI,MAAM;CAAW,CAAA;AAChG;AAEA,SAAS,YAAY,EACnB,MACA,YACA,OACA,QACA,UAOC;CACD,IAAI,MACF,OAAO,oBAAC,cAAD;EAAc,WAAU;EAAiC;CAAO,CAAA;CAGzE,IAAI,YACF,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,SAAS,oBAAC,WAAD,EAAW,OAAO,OAAS,CAAA,IAAI;EACzC,oBAAC,QAAD,EAAA,UAAO,MAAY,CAA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,CAAA;AAEd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
export declare const POPOVER_SURFACE = "z-
|
|
3
|
+
export declare const POPOVER_SURFACE = "z-lt-popover rounded-lt-sm border border-lt-border bg-lt-popover text-lt-popover-fg shadow-lt-md";
|
|
4
4
|
declare function Popover(props: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
5
5
|
declare function PopoverTrigger(props: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
6
6
|
declare function PopoverClose(props: React.ComponentProps<typeof PopoverPrimitive.Close>): React.JSX.Element;
|
|
@@ -3,7 +3,7 @@ import "react";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
5
5
|
//#region resources/js/core/components/popover.tsx
|
|
6
|
-
var POPOVER_SURFACE = "z-
|
|
6
|
+
var POPOVER_SURFACE = "z-lt-popover rounded-lt-sm border border-lt-border bg-lt-popover text-lt-popover-fg shadow-lt-md";
|
|
7
7
|
function Popover(props) {
|
|
8
8
|
return /* @__PURE__ */ jsx(PopoverPrimitive.Root, {
|
|
9
9
|
"data-slot": "popover",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":[],"sources":["../../../resources/js/core/components/popover.tsx"],"sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nexport const POPOVER_SURFACE =\n \"z-
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../../resources/js/core/components/popover.tsx"],"sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nexport const POPOVER_SURFACE =\n \"z-lt-popover rounded-lt-sm border border-lt-border bg-lt-popover text-lt-popover-fg shadow-lt-md\";\n\nfunction Popover(props: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger(props: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverClose(props: React.ComponentProps<typeof PopoverPrimitive.Close>) {\n return <PopoverPrimitive.Close data-slot=\"popover-close\" {...props} />;\n}\n\nfunction PopoverContent({\n align = \"start\",\n className,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align={align}\n className={cn(POPOVER_SURFACE, className)}\n data-slot=\"popover-content\"\n sideOffset={sideOffset}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nexport { Popover, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":";;;;;AAIA,IAAa,kBACX;AAEF,SAAS,QAAQ,OAA2D;CAC1E,OAAO,oBAAC,iBAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,eAAe,OAA8D;CACpF,OAAO,oBAAC,iBAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,aAAa,OAA4D;CAChF,OAAO,oBAAC,iBAAiB,OAAlB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,eAAe,EACtB,QAAQ,SACR,WACA,aAAa,GACb,GAAG,SACqD;CACxD,OACE,oBAAC,iBAAiB,QAAlB,EAAA,UACE,oBAAC,iBAAiB,SAAlB;EACS;EACP,WAAW,GAAG,iBAAiB,SAAS;EACxC,aAAU;EACE;EACZ,GAAI;CACL,CAAA,EACsB,CAAA;AAE7B"}
|