@lattice-php/lattice 0.13.0 → 0.15.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 +13 -6
- package/dist/core/components/card.js.map +1 -1
- package/dist/core/components/collapsible.js +9 -2
- package/dist/core/components/collapsible.js.map +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/eager.d.ts +1 -0
- package/dist/core/components/eager.js +50 -0
- package/dist/core/components/eager.js.map +1 -0
- 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/heading.js +10 -8
- package/dist/core/components/heading.js.map +1 -1
- package/dist/core/components/index.js +3 -1
- package/dist/core/components/index.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 +18 -10
- 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/core/components/tooltip.d.ts +3 -0
- package/dist/core/components/tooltip.js +25 -0
- package/dist/core/components/tooltip.js.map +1 -0
- package/dist/core/renderer.js +1 -1
- package/dist/create-app.js +7 -3
- package/dist/create-app.js.map +1 -1
- package/dist/form/components/base/field.js +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/checkbox.js +2 -2
- package/dist/form/components/fields/date-picker-control.js +2 -2
- 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/select.js +3 -2
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/toggle.js +1 -1
- package/dist/form/components/form.js +2 -1
- package/dist/form/components/form.js.map +1 -1
- package/dist/form/components/index.js +1 -1
- package/dist/form/eager.d.ts +1 -0
- package/dist/form/eager.js +47 -0
- package/dist/form/eager.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- 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/provider-base.d.ts +10 -0
- package/dist/provider-base.js +27 -0
- package/dist/provider-base.js.map +1 -0
- package/dist/provider.d.ts +4 -7
- package/dist/provider.js +9 -22
- package/dist/provider.js.map +1 -1
- package/dist/registry/eager.d.ts +1 -0
- package/dist/registry/eager.js +14 -0
- package/dist/registry/eager.js.map +1 -0
- package/dist/registry/lazy.d.ts +1 -0
- package/dist/registry/lazy.js +14 -0
- package/dist/registry/lazy.js.map +1 -0
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +2 -14
- 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 +3 -3
- 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 +11 -5
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/eager.d.ts +1 -0
- package/dist/table/eager.js +11 -0
- package/dist/table/eager.js.map +1 -0
- package/dist/table/use-table.js +1 -1
- package/dist/toast/toaster.js +1 -1
- package/dist/toast/toaster.js.map +1 -1
- package/dist/types/generated.d.ts +15 -0
- package/package.json +9 -1
- package/dist/registry.js.map +0 -1
|
@@ -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"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
2
|
import { nodeIdentity } from "../test-id.js";
|
|
3
|
+
import { InfoTooltip } from "./info-tooltip.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region resources/js/core/components/card.tsx
|
|
6
7
|
function Card({ className, ...props }) {
|
|
7
8
|
return /* @__PURE__ */ jsx("article", {
|
|
8
9
|
"data-slot": "card",
|
|
9
|
-
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),
|
|
10
11
|
...props
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
function CardHeader({ className, ...props }) {
|
|
14
15
|
return /* @__PURE__ */ jsx("div", {
|
|
15
16
|
"data-slot": "card-header",
|
|
16
|
-
className: cn("flex flex-col gap-1.5 px-
|
|
17
|
+
className: cn("flex flex-col gap-1.5 px-lt-gutter", className),
|
|
17
18
|
...props
|
|
18
19
|
});
|
|
19
20
|
}
|
|
@@ -34,22 +35,28 @@ function CardDescription({ className, ...props }) {
|
|
|
34
35
|
function CardContent({ className, ...props }) {
|
|
35
36
|
return /* @__PURE__ */ jsx("div", {
|
|
36
37
|
"data-slot": "card-content",
|
|
37
|
-
className: cn("px-
|
|
38
|
+
className: cn("px-lt-gutter", className),
|
|
38
39
|
...props
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
function CardFooter({ className, ...props }) {
|
|
42
43
|
return /* @__PURE__ */ jsx("div", {
|
|
43
44
|
"data-slot": "card-footer",
|
|
44
|
-
className: cn("flex items-center px-
|
|
45
|
+
className: cn("flex items-center px-lt-gutter", className),
|
|
45
46
|
...props
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
var CardComponent = ({ children, node }) => {
|
|
49
|
-
const { title, description } = node.props;
|
|
50
|
+
const { title, description, tooltip } = node.props;
|
|
50
51
|
return /* @__PURE__ */ jsxs(Card, {
|
|
51
52
|
"data-lattice-component": nodeIdentity(node),
|
|
52
|
-
children: [(title || description) && /* @__PURE__ */ jsxs(CardHeader, { children: [title && /* @__PURE__ */
|
|
53
|
+
children: [(title || description) && /* @__PURE__ */ jsxs(CardHeader, { children: [title && /* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "flex items-center",
|
|
55
|
+
children: [/* @__PURE__ */ jsx(CardTitle, { children: title }), /* @__PURE__ */ jsx(InfoTooltip, { content: tooltip })]
|
|
56
|
+
}), description && /* @__PURE__ */ jsxs("div", {
|
|
57
|
+
className: "flex items-center",
|
|
58
|
+
children: [/* @__PURE__ */ jsx(CardDescription, { children: description }), !title && /* @__PURE__ */ jsx(InfoTooltip, { content: tooltip })]
|
|
59
|
+
})] }), children && /* @__PURE__ */ jsx(CardContent, {
|
|
53
60
|
className: "flex flex-col gap-6",
|
|
54
61
|
children
|
|
55
62
|
})]
|
|
@@ -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\";\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"}
|
|
@@ -2,6 +2,7 @@ import { cn } from "../../lib/utils.js";
|
|
|
2
2
|
import { Icon } from "../../icons/sprite.js";
|
|
3
3
|
import { Renderer } from "../renderer.js";
|
|
4
4
|
import { nodeIdentity, prefixedTestId } from "../test-id.js";
|
|
5
|
+
import { InfoTooltip } from "./info-tooltip.js";
|
|
5
6
|
import { toNodes } from "../nodes.js";
|
|
6
7
|
import { useState } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -26,6 +27,7 @@ var CollapsibleComponent = ({ children, node }) => {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
"data-slot": "collapsible",
|
|
29
31
|
"data-lattice-component": identity,
|
|
30
32
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
31
33
|
"aria-controls": contentId,
|
|
@@ -41,9 +43,14 @@ var CollapsibleComponent = ({ children, node }) => {
|
|
|
41
43
|
},
|
|
42
44
|
role: "button",
|
|
43
45
|
tabIndex: 0,
|
|
44
|
-
children: [/* @__PURE__ */
|
|
46
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
45
47
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
46
|
-
children: /* @__PURE__ */ jsx(Renderer, { nodes: trigger })
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Renderer, { nodes: trigger }), node.props.tooltip && /* @__PURE__ */ jsx("span", {
|
|
49
|
+
role: "presentation",
|
|
50
|
+
onClick: (event) => event.stopPropagation(),
|
|
51
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
52
|
+
children: /* @__PURE__ */ jsx(InfoTooltip, { content: node.props.tooltip })
|
|
53
|
+
})]
|
|
47
54
|
}), /* @__PURE__ */ jsx(Icon, {
|
|
48
55
|
name: "chevron-down",
|
|
49
56
|
className: cn("size-lt-icon-md shrink-0 text-lt-muted-fg transition-transform", !open && "-rotate-90")
|
|
@@ -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 { 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 </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":"
|
|
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;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,aAAU;EAAc,0BAAwB;YAArD,CACE,qBAAC,OAAD;GACE,iBAAe;GACf,iBAAe;GACf,aAAW,eAAe,sBAAsB,QAAQ,KAAK;GAC7D,WAAU;GACV,SAAS;GACT,YAAY,UAAU;IACpB,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;KAC9C,MAAM,eAAe;KACrB,OAAO;IACT;GACF;GACA,MAAK;GACL,UAAU;aAbZ,CAeE,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,UAAD,EAAU,OAAO,QAAU,CAAA,GAC1B,KAAK,MAAM,WACV,oBAAC,QAAD;KACE,MAAK;KACL,UAAU,UAAU,MAAM,gBAAgB;KAC1C,YAAY,UAAU,MAAM,gBAAgB;eAE5C,oBAAC,aAAD,EAAa,SAAS,KAAK,MAAM,QAAU,CAAA;IACvC,CAAA,CAEL;OACL,oBAAC,MAAD;IACE,MAAK;IACL,WAAW,GACT,kEACA,CAAC,QAAQ,YACX;GACD,CAAA,CACE;MAEJ,QAAQ,YACP,oBAAC,OAAD;GAAK,IAAI;GAAW,WAAU;GAC3B;EACE,CAAA,CAEJ;;AAET"}
|
|
@@ -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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const eagerCoreComponents: import('../registry').Plugin;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createPlugin, eagerComponent } from "../registry.js";
|
|
2
|
+
import ButtonComponent from "./button.js";
|
|
3
|
+
import BadgeComponent from "./badge.js";
|
|
4
|
+
import CardComponent from "./card.js";
|
|
5
|
+
import CollapsibleComponent from "./collapsible.js";
|
|
6
|
+
import FloatingPanelComponent from "./floating-panel.js";
|
|
7
|
+
import FragmentComponent from "./fragment.js";
|
|
8
|
+
import GridComponent from "./grid.js";
|
|
9
|
+
import HeadingComponent from "./heading.js";
|
|
10
|
+
import IconComponent from "./icon.js";
|
|
11
|
+
import LinkComponent from "./link.js";
|
|
12
|
+
import ModalComponent from "./modal.js";
|
|
13
|
+
import RawBlockComponent from "./raw-block.js";
|
|
14
|
+
import SectionComponent from "./section.js";
|
|
15
|
+
import SegmentedControlComponent from "./segmented-control.js";
|
|
16
|
+
import StackComponent from "./stack.js";
|
|
17
|
+
import TabComponent, { TabsComponent } from "./tabs.js";
|
|
18
|
+
import TextComponent from "./text.js";
|
|
19
|
+
import TooltipComponent from "./tooltip.js";
|
|
20
|
+
import ChartComponent from "./chart.js";
|
|
21
|
+
//#region resources/js/core/components/eager.ts
|
|
22
|
+
var eagerCoreComponents = createPlugin({
|
|
23
|
+
components: {
|
|
24
|
+
badge: eagerComponent(BadgeComponent),
|
|
25
|
+
button: eagerComponent(ButtonComponent),
|
|
26
|
+
card: eagerComponent(CardComponent),
|
|
27
|
+
chart: eagerComponent(ChartComponent),
|
|
28
|
+
collapsible: eagerComponent(CollapsibleComponent),
|
|
29
|
+
"floating-panel": eagerComponent(FloatingPanelComponent),
|
|
30
|
+
fragment: eagerComponent(FragmentComponent),
|
|
31
|
+
grid: eagerComponent(GridComponent),
|
|
32
|
+
heading: eagerComponent(HeadingComponent),
|
|
33
|
+
icon: eagerComponent(IconComponent),
|
|
34
|
+
link: eagerComponent(LinkComponent),
|
|
35
|
+
modal: eagerComponent(ModalComponent),
|
|
36
|
+
"raw-block": eagerComponent(RawBlockComponent),
|
|
37
|
+
section: eagerComponent(SectionComponent),
|
|
38
|
+
"segmented-control": eagerComponent(SegmentedControlComponent),
|
|
39
|
+
stack: eagerComponent(StackComponent),
|
|
40
|
+
tab: eagerComponent(TabComponent),
|
|
41
|
+
tabs: eagerComponent(TabsComponent),
|
|
42
|
+
text: eagerComponent(TextComponent),
|
|
43
|
+
tooltip: eagerComponent(TooltipComponent)
|
|
44
|
+
},
|
|
45
|
+
name: "lattice/core"
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
48
|
+
export { eagerCoreComponents };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=eager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eager.js","names":[],"sources":["../../../resources/js/core/components/eager.ts"],"sourcesContent":["import { createPlugin, eagerComponent } from \"@lattice-php/lattice/core/registry\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport ChartComponent from \"./chart\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\nimport TooltipComponent from \"./tooltip\";\n\nexport const eagerCoreComponents = createPlugin({\n components: {\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: eagerComponent(ChartComponent),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n tooltip: eagerComponent(TooltipComponent),\n },\n name: \"lattice/core\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,sBAAsB,aAAa;CAC9C,YAAY;EACV,OAAO,eAAe,cAAc;EACpC,QAAQ,eAAe,eAAe;EACtC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,oBAAoB;EAChD,kBAAkB,eAAe,sBAAsB;EACvD,UAAU,eAAe,iBAAiB;EAC1C,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;EACxC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,iBAAiB;EAC7C,SAAS,eAAe,gBAAgB;EACxC,qBAAqB,eAAe,yBAAyB;EAC7D,OAAO,eAAe,cAAc;EACpC,KAAK,eAAe,YAAY;EAChC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;CAC1C;CACA,MAAM;AACR,CAAC"}
|
|
@@ -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,34 +1,36 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { InfoTooltip } from "./info-tooltip.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region resources/js/core/components/heading.tsx
|
|
4
5
|
var HeadingComponent = ({ node }) => {
|
|
5
|
-
const { text } = node.props;
|
|
6
|
+
const { text, tooltip } = node.props;
|
|
6
7
|
const level = Math.min(Math.max(node.props.level, 1), 6);
|
|
7
8
|
const className = cn("max-w-3xl font-semibold tracking-normal text-balance text-lt-fg", level === 1 && "text-2xl font-bold leading-tight", level === 2 && "text-xl", level > 2 && "text-base");
|
|
9
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [text, /* @__PURE__ */ jsx(InfoTooltip, { content: tooltip })] });
|
|
8
10
|
switch (level) {
|
|
9
11
|
case 1: return /* @__PURE__ */ jsx("h1", {
|
|
10
12
|
className,
|
|
11
|
-
children:
|
|
13
|
+
children: content
|
|
12
14
|
});
|
|
13
15
|
case 2: return /* @__PURE__ */ jsx("h2", {
|
|
14
16
|
className,
|
|
15
|
-
children:
|
|
17
|
+
children: content
|
|
16
18
|
});
|
|
17
19
|
case 3: return /* @__PURE__ */ jsx("h3", {
|
|
18
20
|
className,
|
|
19
|
-
children:
|
|
21
|
+
children: content
|
|
20
22
|
});
|
|
21
23
|
case 4: return /* @__PURE__ */ jsx("h4", {
|
|
22
24
|
className,
|
|
23
|
-
children:
|
|
25
|
+
children: content
|
|
24
26
|
});
|
|
25
27
|
case 5: return /* @__PURE__ */ jsx("h5", {
|
|
26
28
|
className,
|
|
27
|
-
children:
|
|
29
|
+
children: content
|
|
28
30
|
});
|
|
29
31
|
default: return /* @__PURE__ */ jsx("h6", {
|
|
30
32
|
className,
|
|
31
|
-
children:
|
|
33
|
+
children: content
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","names":[],"sources":["../../../resources/js/core/components/heading.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nconst HeadingComponent: RendererComponent<\"heading\"> = ({ node }) => {\n const { text } = node.props;\n const level = Math.min(Math.max(node.props.level, 1), 6);\n const className = cn(\n \"max-w-3xl font-semibold tracking-normal text-balance text-lt-fg\",\n level === 1 && \"text-2xl font-bold leading-tight\",\n level === 2 && \"text-xl\",\n level > 2 && \"text-base\",\n );\n\n switch (level) {\n case 1:\n return <h1 className={className}>{
|
|
1
|
+
{"version":3,"file":"heading.js","names":[],"sources":["../../../resources/js/core/components/heading.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { InfoTooltip } from \"./info-tooltip\";\n\nconst HeadingComponent: RendererComponent<\"heading\"> = ({ node }) => {\n const { text, tooltip } = node.props;\n const level = Math.min(Math.max(node.props.level, 1), 6);\n const className = cn(\n \"max-w-3xl font-semibold tracking-normal text-balance text-lt-fg\",\n level === 1 && \"text-2xl font-bold leading-tight\",\n level === 2 && \"text-xl\",\n level > 2 && \"text-base\",\n );\n\n const content = (\n <>\n {text}\n <InfoTooltip content={tooltip} />\n </>\n );\n\n switch (level) {\n case 1:\n return <h1 className={className}>{content}</h1>;\n case 2:\n return <h2 className={className}>{content}</h2>;\n case 3:\n return <h3 className={className}>{content}</h3>;\n case 4:\n return <h4 className={className}>{content}</h4>;\n case 5:\n return <h5 className={className}>{content}</h5>;\n default:\n return <h6 className={className}>{content}</h6>;\n }\n};\n\nexport default HeadingComponent;\n"],"mappings":";;;;AAIA,IAAM,oBAAkD,EAAE,WAAW;CACnE,MAAM,EAAE,MAAM,YAAY,KAAK;CAC/B,MAAM,QAAQ,KAAK,IAAI,KAAK,IAAI,KAAK,MAAM,OAAO,CAAC,GAAG,CAAC;CACvD,MAAM,YAAY,GAChB,mEACA,UAAU,KAAK,oCACf,UAAU,KAAK,WACf,QAAQ,KAAK,WACf;CAEA,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA,CACG,MACD,oBAAC,aAAD,EAAa,SAAS,QAAU,CAAA,CAChC,EAAA,CAAA;CAGJ,QAAQ,OAAR;EACE,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAY,CAAA;EAChD,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAY,CAAA;EAChD,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAY,CAAA;EAChD,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAY,CAAA;EAChD,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAY,CAAA;EAChD,SACE,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAY,CAAA;CAClD;AACF"}
|
|
@@ -16,6 +16,7 @@ import SegmentedControlComponent from "./segmented-control.js";
|
|
|
16
16
|
import StackComponent from "./stack.js";
|
|
17
17
|
import TabComponent, { TabsComponent } from "./tabs.js";
|
|
18
18
|
import TextComponent from "./text.js";
|
|
19
|
+
import TooltipComponent from "./tooltip.js";
|
|
19
20
|
//#region resources/js/core/components/index.ts
|
|
20
21
|
var coreComponents = createPlugin({
|
|
21
22
|
components: {
|
|
@@ -37,7 +38,8 @@ var coreComponents = createPlugin({
|
|
|
37
38
|
stack: eagerComponent(StackComponent),
|
|
38
39
|
tab: eagerComponent(TabComponent),
|
|
39
40
|
tabs: eagerComponent(TabsComponent),
|
|
40
|
-
text: eagerComponent(TextComponent)
|
|
41
|
+
text: eagerComponent(TextComponent),
|
|
42
|
+
tooltip: eagerComponent(TooltipComponent)
|
|
41
43
|
},
|
|
42
44
|
name: "lattice/core"
|
|
43
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../resources/js/core/components/index.ts"],"sourcesContent":["import { createPlugin, eagerComponent, lazyComponent } from \"@lattice-php/lattice/core/registry\";\nimport type { RendererComponentModule } from \"@lattice-php/lattice/core/types\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\n\nexport const coreComponents = createPlugin({\n components: {\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: lazyComponent(\n () => import(\"./chart\") as unknown as Promise<RendererComponentModule<\"chart\">>,\n ),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n },\n name: \"lattice/core\",\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../resources/js/core/components/index.ts"],"sourcesContent":["import { createPlugin, eagerComponent, lazyComponent } from \"@lattice-php/lattice/core/registry\";\nimport type { RendererComponentModule } from \"@lattice-php/lattice/core/types\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\nimport TooltipComponent from \"./tooltip\";\n\nexport const coreComponents = createPlugin({\n components: {\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: lazyComponent(\n () => import(\"./chart\") as unknown as Promise<RendererComponentModule<\"chart\">>,\n ),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n tooltip: eagerComponent(TooltipComponent),\n },\n name: \"lattice/core\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,iBAAiB,aAAa;CACzC,YAAY;EACV,OAAO,eAAe,cAAc;EACpC,QAAQ,eAAe,eAAe;EACtC,MAAM,eAAe,aAAa;EAClC,OAAO,oBACC,OAAO,aACf;EACA,aAAa,eAAe,oBAAoB;EAChD,kBAAkB,eAAe,sBAAsB;EACvD,UAAU,eAAe,iBAAiB;EAC1C,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;EACxC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,iBAAiB;EAC7C,SAAS,eAAe,gBAAgB;EACxC,qBAAqB,eAAe,yBAAyB;EAC7D,OAAO,eAAe,cAAc;EACpC,KAAK,eAAe,YAAY;EAChC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;CAC1C;CACA,MAAM;AACR,CAAC"}
|
|
@@ -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,CAAA;EAClB,SAAS,oBAAC,WAAD;GAAW,OAAO;GAAQ,WAAU;EAAW,CAAA,IAAI;CAC7D,EAAA,CAAA;CAIN,IAAI,UAAU,QACZ,OACE,qBAAC,QAAD;EAAM,WAAU;YAAhB;GACG,SAAS,oBAAC,WAAD,EAAW,OAAO,OAAS,CAAA,IAAI;GACzC,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;GAClB,SAAS,oBAAC,WAAD,EAAW,OAAO,OAAS,CAAA,IAAI;EACrC;;CAIV,OAAO;AACT;AAEA,SAAS,qBAAqB,OAAe,QAAuB,QAAuB;CACzF,IAAI,CAAC,QAAQ,QAAQ,CAAC,QAAQ,MAC5B;CAGF,OAAO;EAAC,QAAQ;EAAM;EAAO,QAAQ;CAAI,EACtC,QAAQ,SAAyB,QAAQ,IAAI,CAAC,EAC9C,KAAK,GAAG;AACb;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,aAAa,cAAc;CACjC,MAAM,SAAS,KAAK,MAAM;CAC1B,MAAM,OAAO,KAAK,MAAM;CACxB,MAAM,QAAQ,KAAK,MAAM;CACzB,MAAM,SAAS,KAAK,MAAM;CAC1B,MAAM,SAAS,KAAK,MAAM;CAC1B,MAAM,WAAW,QAAQ,IAAI;CAC7B,MAAM,UACJ,oBAAC,aAAD;EACQ;EACM;EACL;EACC;EACA;CACT,CAAA;CAEH,MAAM,YAAY,WAAW,QAAQ,qBAAqB,OAAO,QAAQ,MAAM;CAE/E,IAAI,QACF,OACE,oBAAC,YAAD;EACU;EACG;EACX,WAAW,aAAa,0BAA0B,KAAA;EAClD,QAAQ,aAAa,IAAI;YAExB;CACS,CAAA;CAIhB,OACE,oBAAC,UAAD;EACE,cAAY;EACZ,WAAW,aAAa,0BAA0B,KAAA;EAClD,aAAW,aAAa,IAAI;EAC5B,MAAM,KAAK,MAAM,QAAQ;EACzB,QAAQ,KAAK,MAAM,UAAU;EAC7B,UAAU,KAAK,MAAM,YAAY,KAAA;YAEhC;CACO,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;
|