@lattice-php/lattice 0.13.0 → 0.14.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.
Files changed (53) hide show
  1. package/dist/core/components/card.js +9 -2
  2. package/dist/core/components/card.js.map +1 -1
  3. package/dist/core/components/collapsible.js +8 -2
  4. package/dist/core/components/collapsible.js.map +1 -1
  5. package/dist/core/components/eager.d.ts +1 -0
  6. package/dist/core/components/eager.js +50 -0
  7. package/dist/core/components/eager.js.map +1 -0
  8. package/dist/core/components/heading.js +10 -8
  9. package/dist/core/components/heading.js.map +1 -1
  10. package/dist/core/components/index.js +3 -1
  11. package/dist/core/components/index.js.map +1 -1
  12. package/dist/core/components/section.js +14 -7
  13. package/dist/core/components/section.js.map +1 -1
  14. package/dist/core/components/tooltip.d.ts +3 -0
  15. package/dist/core/components/tooltip.js +25 -0
  16. package/dist/core/components/tooltip.js.map +1 -0
  17. package/dist/core/renderer.js +1 -1
  18. package/dist/create-app.js +7 -3
  19. package/dist/create-app.js.map +1 -1
  20. package/dist/form/components/base/field.js +1 -1
  21. package/dist/form/components/fields/checkbox.js +2 -2
  22. package/dist/form/components/fields/select.js +3 -2
  23. package/dist/form/components/fields/select.js.map +1 -1
  24. package/dist/form/components/fields/toggle.js +1 -1
  25. package/dist/form/components/index.js +1 -1
  26. package/dist/form/eager.d.ts +1 -0
  27. package/dist/form/eager.js +47 -0
  28. package/dist/form/eager.js.map +1 -0
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +5 -5
  31. package/dist/provider-base.d.ts +10 -0
  32. package/dist/provider-base.js +27 -0
  33. package/dist/provider-base.js.map +1 -0
  34. package/dist/provider.d.ts +4 -7
  35. package/dist/provider.js +9 -22
  36. package/dist/provider.js.map +1 -1
  37. package/dist/registry/eager.d.ts +1 -0
  38. package/dist/registry/eager.js +14 -0
  39. package/dist/registry/eager.js.map +1 -0
  40. package/dist/registry/lazy.d.ts +1 -0
  41. package/dist/registry/lazy.js +14 -0
  42. package/dist/registry/lazy.js.map +1 -0
  43. package/dist/registry.d.ts +1 -1
  44. package/dist/registry.js +2 -14
  45. package/dist/table/components/filter-controls.js +1 -1
  46. package/dist/table/components/table.js +2 -2
  47. package/dist/table/eager.d.ts +1 -0
  48. package/dist/table/eager.js +11 -0
  49. package/dist/table/eager.js.map +1 -0
  50. package/dist/table/use-table.js +1 -1
  51. package/dist/types/generated.d.ts +12 -0
  52. package/package.json +9 -1
  53. package/dist/registry.js.map +0 -1
@@ -1,5 +1,6 @@
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
@@ -46,10 +47,16 @@ function CardFooter({ className, ...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__ */ jsx(CardTitle, { children: title }), description && /* @__PURE__ */ jsx(CardDescription, { children: description })] }), children && /* @__PURE__ */ jsx(CardContent, {
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-6 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-6\", 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-6\", className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div data-slot=\"card-footer\" className={cn(\"flex items-center px-6\", className)} {...props} />\n );\n}\n\nconst CardComponent: RendererComponent<\"card\"> = ({ children, node }) => {\n const { title, description } = node.props;\n\n return (\n <Card data-lattice-component={nodeIdentity(node)}>\n {(title || description) && (\n <CardHeader>\n {title && <CardTitle>{title}</CardTitle>}\n {description && <CardDescription>{description}</CardDescription>}\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, C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}
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-6 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-6\", 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-6\", className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div data-slot=\"card-footer\" className={cn(\"flex items-center px-6\", className)} {...props} />\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,6GACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,8BAA8B,SAAS;EACrD,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,QAAQ,SAAS;EAAG,GAAI;CAAQ,CAAA;AACrF;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EAAK,aAAU;EAAc,WAAW,GAAG,0BAA0B,SAAS;EAAG,GAAI;CAAQ,CAAA;AAEjG;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";
@@ -41,9 +42,14 @@ var CollapsibleComponent = ({ children, node }) => {
41
42
  },
42
43
  role: "button",
43
44
  tabIndex: 0,
44
- children: [/* @__PURE__ */ jsx("div", {
45
+ children: [/* @__PURE__ */ jsxs("div", {
45
46
  className: "flex min-w-0 flex-1 items-center gap-2",
46
- children: /* @__PURE__ */ jsx(Renderer, { nodes: trigger })
47
+ children: [/* @__PURE__ */ jsx(Renderer, { nodes: trigger }), node.props.tooltip && /* @__PURE__ */ jsx("span", {
48
+ role: "presentation",
49
+ onClick: (event) => event.stopPropagation(),
50
+ onKeyDown: (event) => event.stopPropagation(),
51
+ children: /* @__PURE__ */ jsx(InfoTooltip, { content: node.props.tooltip })
52
+ })]
47
53
  }), /* @__PURE__ */ jsx(Icon, {
48
54
  name: "chevron-down",
49
55
  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":";;;;;;;;AAQA,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;YAA7B,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,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,UAAD,EAAU,OAAO,QAAU,CAAA;GACxB,CAAA,GACL,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
+ {"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;YAA7B,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"}
@@ -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"}
@@ -1,34 +1,36 @@
1
1
  import { cn } from "../../lib/utils.js";
2
- import { jsx } from "react/jsx-runtime";
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: text
13
+ children: content
12
14
  });
13
15
  case 2: return /* @__PURE__ */ jsx("h2", {
14
16
  className,
15
- children: text
17
+ children: content
16
18
  });
17
19
  case 3: return /* @__PURE__ */ jsx("h3", {
18
20
  className,
19
- children: text
21
+ children: content
20
22
  });
21
23
  case 4: return /* @__PURE__ */ jsx("h4", {
22
24
  className,
23
- children: text
25
+ children: content
24
26
  });
25
27
  case 5: return /* @__PURE__ */ jsx("h5", {
26
28
  className,
27
- children: text
29
+ children: content
28
30
  });
29
31
  default: return /* @__PURE__ */ jsx("h6", {
30
32
  className,
31
- children: text
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}>{text}</h1>;\n case 2:\n return <h2 className={className}>{text}</h2>;\n case 3:\n return <h3 className={className}>{text}</h3>;\n case 4:\n return <h4 className={className}>{text}</h4>;\n case 5:\n return <h5 className={className}>{text}</h5>;\n default:\n return <h6 className={className}>{text}</h6>;\n }\n};\n\nexport default HeadingComponent;\n"],"mappings":";;;AAGA,IAAM,oBAAkD,EAAE,WAAW;CACnE,MAAM,EAAE,SAAS,KAAK;CACtB,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,QAAQ,OAAR;EACE,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAS,CAAA;EAC7C,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAS,CAAA;EAC7C,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAS,CAAA;EAC7C,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAS,CAAA;EAC7C,KAAK,GACH,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAS,CAAA;EAC7C,SACE,OAAO,oBAAC,MAAD;GAAe;aAAY;EAAS,CAAA;CAC/C;AACF"}
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":";;;;;;;;;;;;;;;;;;;AAoBA,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;CACpC;CACA,MAAM;AACR,CAAC"}
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"}
@@ -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";
@@ -12,7 +13,7 @@ function readStored(key, remember, fallback) {
12
13
  return stored === null ? fallback : stored === "true";
13
14
  }
14
15
  var SectionComponent = ({ children, node }) => {
15
- const { title, description } = node.props;
16
+ const { title, description, tooltip } = node.props;
16
17
  const collapsible = node.props.collapsible === true;
17
18
  const rememberState = node.props.rememberState !== false;
18
19
  const headerActions = toNodes(node.props.headerActions);
@@ -47,12 +48,18 @@ var SectionComponent = ({ children, node }) => {
47
48
  })
48
49
  }), /* @__PURE__ */ jsxs("div", {
49
50
  className: "flex min-w-0 flex-col gap-1.5",
50
- children: [title && /* @__PURE__ */ jsx("div", {
51
- className: "font-semibold leading-none",
52
- children: title
53
- }), description && /* @__PURE__ */ jsx("div", {
54
- className: "text-sm text-lt-muted-fg",
55
- children: description
51
+ children: [title && /* @__PURE__ */ jsxs("div", {
52
+ className: "flex items-center",
53
+ children: [/* @__PURE__ */ jsx("div", {
54
+ className: "font-semibold leading-none",
55
+ children: title
56
+ }), /* @__PURE__ */ jsx(InfoTooltip, { content: tooltip })]
57
+ }), description && /* @__PURE__ */ jsxs("div", {
58
+ className: "flex items-center",
59
+ children: [/* @__PURE__ */ jsx("div", {
60
+ className: "text-sm text-lt-muted-fg",
61
+ children: description
62
+ }), !title && /* @__PURE__ */ jsx(InfoTooltip, { content: tooltip })]
56
63
  })]
57
64
  })]
58
65
  }), headerActions.length > 0 && /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"section.js","names":[],"sources":["../../../resources/js/core/components/section.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 SectionComponent: RendererComponent<\"section\"> = ({ children, node }) => {\n const { title, description } = node.props;\n const collapsible = node.props.collapsible === true;\n const rememberState = node.props.rememberState !== false;\n const headerActions = toNodes(node.props.headerActions);\n const identity = nodeIdentity(node);\n const storageKey = `lattice:section:${identity ?? \"default\"}`;\n\n const [collapsed, setCollapsed] = useState(() =>\n readStored(storageKey, collapsible && rememberState, node.props.collapsed === true),\n );\n\n function toggle(): void {\n setCollapsed((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 const isCollapsed = collapsible && collapsed;\n const hasHeader = Boolean(title || description || headerActions.length > 0 || collapsible);\n\n return (\n <section\n className=\"flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-6 text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={identity}\n >\n {hasHeader && (\n <div className=\"flex items-start justify-between gap-4 px-6\">\n <div className=\"flex min-w-0 items-start gap-2\">\n {collapsible && (\n <button\n aria-expanded={!isCollapsed}\n aria-label={isCollapsed ? \"Expand section\" : \"Collapse section\"}\n data-test={prefixedTestId(\"section-toggle\", identity) ?? \"section-toggle-default\"}\n className=\"mt-0.5 inline-flex shrink-0 items-center rounded-lt-sm p-0.5 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg\"\n onClick={toggle}\n type=\"button\"\n >\n <Icon\n name=\"chevron-down\"\n className={cn(\n \"size-lt-icon-md transition-transform\",\n isCollapsed && \"-rotate-90\",\n )}\n />\n </button>\n )}\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title && <div className=\"font-semibold leading-none\">{title}</div>}\n {description && <div className=\"text-sm text-lt-muted-fg\">{description}</div>}\n </div>\n </div>\n\n {headerActions.length > 0 && (\n <div className=\"flex shrink-0 items-center gap-2\">\n <Renderer nodes={headerActions} />\n </div>\n )}\n </div>\n )}\n\n {!isCollapsed && children && <div className=\"flex flex-col gap-6 px-6\">{children}</div>}\n </section>\n );\n};\n\nexport default SectionComponent;\n"],"mappings":";;;;;;;;AAQA,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,oBAAkD,EAAE,UAAU,WAAW;CAC7E,MAAM,EAAE,OAAO,gBAAgB,KAAK;CACpC,MAAM,cAAc,KAAK,MAAM,gBAAgB;CAC/C,MAAM,gBAAgB,KAAK,MAAM,kBAAkB;CACnD,MAAM,gBAAgB,QAAQ,KAAK,MAAM,aAAa;CACtD,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,aAAa,mBAAmB,YAAY;CAElD,MAAM,CAAC,WAAW,gBAAgB,eAChC,WAAW,YAAY,eAAe,eAAe,KAAK,MAAM,cAAc,IAAI,CACpF;CAEA,SAAS,SAAe;EACtB,cAAc,UAAU;GACtB,MAAM,OAAO,CAAC;GAEd,IAAI,iBAAiB,OAAO,WAAW,aACrC,OAAO,aAAa,QAAQ,YAAY,OAAO,IAAI,CAAC;GAGtD,OAAO;EACT,CAAC;CACH;CAEA,MAAM,cAAc,eAAe;CAGnC,OACE,qBAAC,WAAD;EACE,WAAU;EACV,0BAAwB;YAF1B,CAHgB,QAAQ,SAAS,eAAe,cAAc,SAAS,KAAK,WAOzE,KACC,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,OAAD;IAAK,WAAU;cAAf,CACG,eACC,oBAAC,UAAD;KACE,iBAAe,CAAC;KAChB,cAAY,cAAc,mBAAmB;KAC7C,aAAW,eAAe,kBAAkB,QAAQ,KAAK;KACzD,WAAU;KACV,SAAS;KACT,MAAK;eAEL,oBAAC,MAAD;MACE,MAAK;MACL,WAAW,GACT,wCACA,eAAe,YACjB;KACD,CAAA;IACK,CAAA,GAEV,qBAAC,OAAD;KAAK,WAAU;eAAf,CACG,SAAS,oBAAC,OAAD;MAAK,WAAU;gBAA8B;KAAW,CAAA,GACjE,eAAe,oBAAC,OAAD;MAAK,WAAU;gBAA4B;KAAiB,CAAA,CACzE;MACF;OAEJ,cAAc,SAAS,KACtB,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,UAAD,EAAU,OAAO,cAAgB,CAAA;GAC9B,CAAA,CAEJ;MAGN,CAAC,eAAe,YAAY,oBAAC,OAAD;GAAK,WAAU;GAA4B;EAAc,CAAA,CAC/E;;AAEb"}
1
+ {"version":3,"file":"section.js","names":[],"sources":["../../../resources/js/core/components/section.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\";\nimport { InfoTooltip } from \"./info-tooltip\";\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 SectionComponent: RendererComponent<\"section\"> = ({ children, node }) => {\n const { title, description, tooltip } = node.props;\n const collapsible = node.props.collapsible === true;\n const rememberState = node.props.rememberState !== false;\n const headerActions = toNodes(node.props.headerActions);\n const identity = nodeIdentity(node);\n const storageKey = `lattice:section:${identity ?? \"default\"}`;\n\n const [collapsed, setCollapsed] = useState(() =>\n readStored(storageKey, collapsible && rememberState, node.props.collapsed === true),\n );\n\n function toggle(): void {\n setCollapsed((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 const isCollapsed = collapsible && collapsed;\n const hasHeader = Boolean(title || description || headerActions.length > 0 || collapsible);\n\n return (\n <section\n className=\"flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-6 text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={identity}\n >\n {hasHeader && (\n <div className=\"flex items-start justify-between gap-4 px-6\">\n <div className=\"flex min-w-0 items-start gap-2\">\n {collapsible && (\n <button\n aria-expanded={!isCollapsed}\n aria-label={isCollapsed ? \"Expand section\" : \"Collapse section\"}\n data-test={prefixedTestId(\"section-toggle\", identity) ?? \"section-toggle-default\"}\n className=\"mt-0.5 inline-flex shrink-0 items-center rounded-lt-sm p-0.5 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg\"\n onClick={toggle}\n type=\"button\"\n >\n <Icon\n name=\"chevron-down\"\n className={cn(\n \"size-lt-icon-md transition-transform\",\n isCollapsed && \"-rotate-90\",\n )}\n />\n </button>\n )}\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title && (\n <div className=\"flex items-center\">\n <div className=\"font-semibold leading-none\">{title}</div>\n <InfoTooltip content={tooltip} />\n </div>\n )}\n {description && (\n <div className=\"flex items-center\">\n <div className=\"text-sm text-lt-muted-fg\">{description}</div>\n {!title && <InfoTooltip content={tooltip} />}\n </div>\n )}\n </div>\n </div>\n\n {headerActions.length > 0 && (\n <div className=\"flex shrink-0 items-center gap-2\">\n <Renderer nodes={headerActions} />\n </div>\n )}\n </div>\n )}\n\n {!isCollapsed && children && <div className=\"flex flex-col gap-6 px-6\">{children}</div>}\n </section>\n );\n};\n\nexport default SectionComponent;\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,oBAAkD,EAAE,UAAU,WAAW;CAC7E,MAAM,EAAE,OAAO,aAAa,YAAY,KAAK;CAC7C,MAAM,cAAc,KAAK,MAAM,gBAAgB;CAC/C,MAAM,gBAAgB,KAAK,MAAM,kBAAkB;CACnD,MAAM,gBAAgB,QAAQ,KAAK,MAAM,aAAa;CACtD,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,aAAa,mBAAmB,YAAY;CAElD,MAAM,CAAC,WAAW,gBAAgB,eAChC,WAAW,YAAY,eAAe,eAAe,KAAK,MAAM,cAAc,IAAI,CACpF;CAEA,SAAS,SAAe;EACtB,cAAc,UAAU;GACtB,MAAM,OAAO,CAAC;GAEd,IAAI,iBAAiB,OAAO,WAAW,aACrC,OAAO,aAAa,QAAQ,YAAY,OAAO,IAAI,CAAC;GAGtD,OAAO;EACT,CAAC;CACH;CAEA,MAAM,cAAc,eAAe;CAGnC,OACE,qBAAC,WAAD;EACE,WAAU;EACV,0BAAwB;YAF1B,CAHgB,QAAQ,SAAS,eAAe,cAAc,SAAS,KAAK,WAOzE,KACC,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,OAAD;IAAK,WAAU;cAAf,CACG,eACC,oBAAC,UAAD;KACE,iBAAe,CAAC;KAChB,cAAY,cAAc,mBAAmB;KAC7C,aAAW,eAAe,kBAAkB,QAAQ,KAAK;KACzD,WAAU;KACV,SAAS;KACT,MAAK;eAEL,oBAAC,MAAD;MACE,MAAK;MACL,WAAW,GACT,wCACA,eAAe,YACjB;KACD,CAAA;IACK,CAAA,GAEV,qBAAC,OAAD;KAAK,WAAU;eAAf,CACG,SACC,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,oBAAC,OAAD;OAAK,WAAU;iBAA8B;MAAW,CAAA,GACxD,oBAAC,aAAD,EAAa,SAAS,QAAU,CAAA,CAC7B;SAEN,eACC,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,oBAAC,OAAD;OAAK,WAAU;iBAA4B;MAAiB,CAAA,GAC3D,CAAC,SAAS,oBAAC,aAAD,EAAa,SAAS,QAAU,CAAA,CACxC;OAEJ;MACF;OAEJ,cAAc,SAAS,KACtB,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,UAAD,EAAU,OAAO,cAAgB,CAAA;GAC9B,CAAA,CAEJ;MAGN,CAAC,eAAe,YAAY,oBAAC,OAAD;GAAK,WAAU;GAA4B;EAAc,CAAA,CAC/E;;AAEb"}
@@ -0,0 +1,3 @@
1
+ import { RendererComponent } from '../types';
2
+ declare const TooltipComponent: RendererComponent<"tooltip">;
3
+ export default TooltipComponent;
@@ -0,0 +1,25 @@
1
+ import { Renderer } from "../renderer.js";
2
+ import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
3
+ import { InfoTooltip } from "./info-tooltip.js";
4
+ import { toNodes } from "../nodes.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region resources/js/core/components/tooltip.tsx
7
+ var TooltipComponent = ({ node }) => {
8
+ const content = node.props.content;
9
+ const trigger = toNodes(node.props.trigger);
10
+ if (!content) return null;
11
+ if (trigger.length === 0) return /* @__PURE__ */ jsx(InfoTooltip, { content });
12
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
13
+ type: "button",
14
+ className: "inline-flex items-center rounded-lt-sm outline-none focus-visible:ring-lt-ring/50 focus-visible:ring-[3px]",
15
+ children: /* @__PURE__ */ jsx(Renderer, { nodes: trigger })
16
+ }), /* @__PURE__ */ jsx(PopoverContent, {
17
+ align: "start",
18
+ className: "max-w-xs p-3 text-sm [&_a]:underline",
19
+ dangerouslySetInnerHTML: { __html: content }
20
+ })] });
21
+ };
22
+ //#endregion
23
+ export { TooltipComponent as default };
24
+
25
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","names":[],"sources":["../../../resources/js/core/components/tooltip.tsx"],"sourcesContent":["import { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { toNodes } from \"@lattice-php/lattice/core/nodes\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { InfoTooltip } from \"./info-tooltip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nconst TooltipComponent: RendererComponent<\"tooltip\"> = ({ node }) => {\n const content = node.props.content;\n const trigger = toNodes(node.props.trigger);\n\n if (!content) {\n return null;\n }\n\n if (trigger.length === 0) {\n return <InfoTooltip content={content} />;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n className=\"inline-flex items-center rounded-lt-sm outline-none focus-visible:ring-lt-ring/50 focus-visible:ring-[3px]\"\n >\n <Renderer nodes={trigger} />\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"max-w-xs p-3 text-sm [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: content }}\n />\n </Popover>\n );\n};\n\nexport default TooltipComponent;\n"],"mappings":";;;;;;AAMA,IAAM,oBAAkD,EAAE,WAAW;CACnE,MAAM,UAAU,KAAK,MAAM;CAC3B,MAAM,UAAU,QAAQ,KAAK,MAAM,OAAO;CAE1C,IAAI,CAAC,SACH,OAAO;CAGT,IAAI,QAAQ,WAAW,GACrB,OAAO,oBAAC,aAAD,EAAsB,QAAU,CAAA;CAGzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,MAAK;EACL,WAAU;YAEV,oBAAC,UAAD,EAAU,OAAO,QAAU,CAAA;CACb,CAAA,GAChB,oBAAC,gBAAD;EACE,OAAM;EACN,WAAU;EACV,yBAAyB,EAAE,QAAQ,QAAQ;CAC5C,CAAA,CACM,EAAA,CAAA;AAEb"}
@@ -1,5 +1,5 @@
1
- import { useCollapsed } from "./collapsed-context.js";
2
1
  import { useComponentRegistry } from "./registry-context.js";
2
+ import { useCollapsed } from "./collapsed-context.js";
3
3
  import { Suspense } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region resources/js/core/renderer.tsx
@@ -1,6 +1,8 @@
1
1
  import { initializeTheme } from "./appearance/index.js";
2
+ import { setDefaultRegistry } from "./core/registry-context.js";
2
3
  import { createLayoutResolver, createPageResolver } from "./inertia.js";
3
- import { Provider } from "./provider.js";
4
+ import { ProviderBase } from "./provider-base.js";
5
+ import { lazyRegistry } from "./registry/lazy.js";
4
6
  import { createInertiaApp } from "@inertiajs/react";
5
7
  import { jsx } from "react/jsx-runtime";
6
8
  //#region resources/js/create-app.tsx
@@ -11,13 +13,15 @@ import { jsx } from "react/jsx-runtime";
11
13
  * initialization. Forwards any other createInertiaApp option.
12
14
  */
13
15
  function createLatticeApp({ registry, sprite, pages = {}, defaultLayout, strictMode = true, ...inertiaOptions } = {}) {
16
+ const activeRegistry = registry ?? lazyRegistry;
17
+ setDefaultRegistry(activeRegistry);
14
18
  const app = createInertiaApp({
15
19
  ...inertiaOptions,
16
20
  strictMode,
17
21
  resolve: createPageResolver(pages),
18
22
  layout: createLayoutResolver({ defaultLayout }),
19
- withApp: (node) => /* @__PURE__ */ jsx(Provider, {
20
- registry,
23
+ withApp: (node) => /* @__PURE__ */ jsx(ProviderBase, {
24
+ registry: activeRegistry,
21
25
  sprite,
22
26
  children: node
23
27
  })
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.js","names":[],"sources":["../resources/js/create-app.tsx"],"sourcesContent":["import { createInertiaApp } from \"@inertiajs/react\";\nimport type { ReactElement } from \"react\";\nimport { initializeTheme } from \"./appearance\";\nimport type { Registry } from \"./core/registry\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport {\n createLayoutResolver,\n createPageResolver,\n type CreateLayoutResolverOptions,\n type PageModules,\n} from \"./inertia\";\nimport { Provider } from \"./provider\";\n\ntype InertiaAppOptions = NonNullable<Parameters<typeof createInertiaApp>[0]>;\n\nexport type CreateLatticeAppOptions = Omit<\n InertiaAppOptions,\n \"resolve\" | \"layout\" | \"setup\" | \"withApp\" | \"pages\"\n> & {\n registry?: Registry;\n sprite?: SpriteValue;\n /** Normal Inertia page modules, e.g. `import.meta.glob('./pages/**\\/*.tsx')`. */\n pages?: PageModules;\n defaultLayout?: CreateLayoutResolverOptions[\"defaultLayout\"];\n};\n\n/**\n * Bootstrap an Inertia app with the Lattice shell: the page/layout resolvers\n * (server-driven Lattice pages and normal Inertia pages alike), the Provider —\n * registry, sprite, flash toasts via Lattice's own Toaster — and theme\n * initialization. Forwards any other createInertiaApp option.\n */\nexport function createLatticeApp({\n registry,\n sprite,\n pages = {},\n defaultLayout,\n strictMode = true,\n ...inertiaOptions\n}: CreateLatticeAppOptions = {}) {\n const app = createInertiaApp({\n ...inertiaOptions,\n strictMode,\n resolve: createPageResolver(pages),\n layout: createLayoutResolver({ defaultLayout }),\n withApp: (node: ReactElement): ReactElement => (\n <Provider registry={registry} sprite={sprite}>\n {node}\n </Provider>\n ),\n });\n\n initializeTheme();\n\n return app;\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgB,iBAAiB,EAC/B,UACA,QACA,QAAQ,CAAC,GACT,eACA,aAAa,MACb,GAAG,mBACwB,CAAC,GAAG;CAC/B,MAAM,MAAM,iBAAiB;EAC3B,GAAG;EACH;EACA,SAAS,mBAAmB,KAAK;EACjC,QAAQ,qBAAqB,EAAE,cAAc,CAAC;EAC9C,UAAU,SACR,oBAAC,UAAD;GAAoB;GAAkB;aACnC;EACO,CAAA;CAEd,CAAC;CAED,gBAAgB;CAEhB,OAAO;AACT"}
1
+ {"version":3,"file":"create-app.js","names":[],"sources":["../resources/js/create-app.tsx"],"sourcesContent":["import { createInertiaApp } from \"@inertiajs/react\";\nimport type { ReactElement } from \"react\";\nimport { initializeTheme } from \"./appearance\";\nimport type { Registry } from \"./core/registry\";\nimport { setDefaultRegistry } from \"./core/registry-context\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport {\n createLayoutResolver,\n createPageResolver,\n type CreateLayoutResolverOptions,\n type PageModules,\n} from \"./inertia\";\nimport { ProviderBase } from \"./provider-base\";\nimport { registry as defaultRegistry } from \"./registry\";\n\ntype InertiaAppOptions = NonNullable<Parameters<typeof createInertiaApp>[0]>;\n\nexport type CreateLatticeAppOptions = Omit<\n InertiaAppOptions,\n \"resolve\" | \"layout\" | \"setup\" | \"withApp\" | \"pages\"\n> & {\n registry?: Registry;\n sprite?: SpriteValue;\n /** Normal Inertia page modules, e.g. `import.meta.glob('./pages/**\\/*.tsx')`. */\n pages?: PageModules;\n defaultLayout?: CreateLayoutResolverOptions[\"defaultLayout\"];\n};\n\n/**\n * Bootstrap an Inertia app with the Lattice shell: the page/layout resolvers\n * (server-driven Lattice pages and normal Inertia pages alike), the Provider —\n * registry, sprite, flash toasts via Lattice's own Toaster — and theme\n * initialization. Forwards any other createInertiaApp option.\n */\nexport function createLatticeApp({\n registry,\n sprite,\n pages = {},\n defaultLayout,\n strictMode = true,\n ...inertiaOptions\n}: CreateLatticeAppOptions = {}) {\n const activeRegistry = registry ?? defaultRegistry;\n\n setDefaultRegistry(activeRegistry);\n\n const app = createInertiaApp({\n ...inertiaOptions,\n strictMode,\n resolve: createPageResolver(pages),\n layout: createLayoutResolver({ defaultLayout }),\n withApp: (node: ReactElement): ReactElement => (\n <ProviderBase registry={activeRegistry} sprite={sprite}>\n {node}\n </ProviderBase>\n ),\n });\n\n initializeTheme();\n\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;AAkCA,SAAgB,iBAAiB,EAC/B,UACA,QACA,QAAQ,CAAC,GACT,eACA,aAAa,MACb,GAAG,mBACwB,CAAC,GAAG;CAC/B,MAAM,iBAAiB,YAAY;CAEnC,mBAAmB,cAAc;CAEjC,MAAM,MAAM,iBAAiB;EAC3B,GAAG;EACH;EACA,SAAS,mBAAmB,KAAK;EACjC,QAAQ,qBAAqB,EAAE,cAAc,CAAC;EAC9C,UAAU,SACR,oBAAC,cAAD;GAAc,UAAU;GAAwB;aAC7C;EACW,CAAA;CAElB,CAAC;CAED,gBAAgB;CAEhB,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
- import { TextLink } from "../../../core/components/link.js";
2
1
  import { InfoTooltip } from "../../../core/components/info-tooltip.js";
2
+ import { TextLink } from "../../../core/components/link.js";
3
3
  import InputError from "./input-error.js";
4
4
  import { Label } from "./label.js";
5
5
  import { useInTableCell } from "../row-layout-context.js";
@@ -1,10 +1,10 @@
1
1
  import { testIdentity } from "../../../core/test-id.js";
2
2
  import { useFieldScope } from "../field-scope.js";
3
3
  import { useFormValue } from "../values.js";
4
- import { Checkbox } from "../../../core/components/checkbox.js";
5
- import { toBoolean } from "../conditions.js";
6
4
  import { Label } from "../base/label.js";
5
+ import { toBoolean } from "../conditions.js";
7
6
  import { useDependentField } from "../use-dependent-field.js";
7
+ import { Checkbox } from "../../../core/components/checkbox.js";
8
8
  import { useFieldCommit } from "../use-field-commit.js";
9
9
  import { useSeedDefault } from "../use-seed-default.js";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -6,11 +6,11 @@ import { postFormAction } from "../form-transport.js";
6
6
  import { useFieldScope } from "../field-scope.js";
7
7
  import { useResolvedNode } from "../resolved-nodes.js";
8
8
  import { useFormValue, useFormValues } from "../values.js";
9
- import { Combobox } from "../../../core/components/combobox.js";
10
- import { controlSurface } from "../../../core/components/control.js";
11
9
  import { FormFieldFrame } from "../base/field.js";
12
10
  import { useDependentField } from "../use-dependent-field.js";
13
11
  import { useFieldCommit } from "../use-field-commit.js";
12
+ import { controlSurface } from "../../../core/components/control.js";
13
+ import { Combobox } from "../../../core/components/combobox.js";
14
14
  import { useCallback, useMemo, useRef, useState } from "react";
15
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
16
  //#region resources/js/form/components/fields/select.tsx
@@ -132,6 +132,7 @@ var SelectComponent = ({ node }) => {
132
132
  },
133
133
  options,
134
134
  searchPlaceholder: props.searchPlaceholder ?? void 0,
135
+ showSearch: Boolean(searchable),
135
136
  selected,
136
137
  testId: `select-${name}`,
137
138
  trigger: /* @__PURE__ */ jsxs(Fragment$1, { children: [!multiple && selected.length > 0 ? /* @__PURE__ */ jsx("span", { children: labelFor(selected[0]) }) : /* @__PURE__ */ jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../../resources/js/form/components/fields/select.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport { Combobox } from \"@lattice-php/lattice/core/components/combobox\";\nimport { controlSurface } from \"@lattice-php/lattice/core/components/control\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { Option, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { FormFieldFrame } from \"../base/field\";\nimport { useFormContext } from \"../context\";\nimport { postFormAction } from \"../form-transport\";\nimport { useResolvedNode } from \"../resolved-nodes\";\nimport { useDependentField } from \"../use-dependent-field\";\nimport { useFieldCommit } from \"../use-field-commit\";\nimport { useFieldScope } from \"../field-scope\";\nimport { useFormValue, useFormValues } from \"../values\";\n\nfunction toValues(stored: unknown, fallback: unknown): string[] {\n const source = stored ?? fallback;\n\n if (Array.isArray(source)) {\n return source.map(String);\n }\n\n if (source === undefined || source === null || source === \"\") {\n return [];\n }\n\n return [String(source)];\n}\n\nexport const SelectComponent: RendererComponent<\"field.select\"> = ({ node }) => {\n const { t } = useT(\"lattice\");\n const props = node.props;\n const { action, componentRef, errors } = useFormContext();\n const { hidden, required, readOnly, disabled } = useDependentField(node);\n const { change, blur } = useFieldCommit();\n const resolvedNode = useResolvedNode(node);\n const name = props.name;\n const scope = useFieldScope();\n const domName = scope ? scope.scopedName(name) : name;\n const errorKey = scope ? scope.errorKey(name) : name;\n const searchKey = scope ? scope.errorKey(name) : name;\n const placeholder = props.placeholder || \"Select…\";\n const multiple = props.multiple;\n const searchable = props.searchable;\n const staticOptions = useMemo(\n () => (resolvedNode.props as { options?: Option[] }).options ?? [],\n [resolvedNode.props],\n );\n\n const globalValue = useFormValue(name);\n const values = useFormValues();\n const valuesRef = useRef(values);\n valuesRef.current = values;\n const storedValue = scope ? scope.getValue(name) : globalValue;\n const selected = useMemo(() => toValues(storedValue, props.value), [storedValue, props.value]);\n\n const [open, setOpen] = useState(false);\n const [results, setResults] = useState<Option[] | null>(null);\n const [loading, setLoading] = useState(false);\n const searchAbort = useRef<AbortController | null>(null);\n\n const labels = useMemo(() => {\n const map = new Map<string, string>();\n for (const option of [...staticOptions, ...(results ?? [])]) {\n map.set(option.value, option.label);\n }\n return map;\n }, [staticOptions, results]);\n const labelFor = (value: string) => labels.get(value) ?? value;\n\n const locked = readOnly || disabled;\n\n const search = useCallback(\n (query: string) => {\n searchAbort.current?.abort();\n\n if (query.trim() === \"\") {\n setResults(null);\n setLoading(false);\n\n return;\n }\n\n const controller = new AbortController();\n searchAbort.current = controller;\n setLoading(true);\n\n void postFormAction<{ options?: Option[] }>(\n action,\n componentRef,\n { ...valuesRef.current, _search: searchKey, q: query },\n controller.signal,\n )\n .then((response) => {\n setResults(response?.options ?? []);\n setLoading(false);\n })\n .catch(() => {});\n },\n [action, componentRef, searchKey],\n );\n\n function commit(next: string[]): void {\n change(name, multiple ? next : (next[0] ?? \"\"));\n }\n\n function select(value: string): void {\n if (multiple) {\n commit(\n selected.includes(value) ? selected.filter((item) => item !== value) : [...selected, value],\n );\n\n return;\n }\n\n commit([value]);\n }\n\n function remove(value: string): void {\n commit(selected.filter((item) => item !== value));\n }\n\n if (hidden) {\n return null;\n }\n\n const options = searchable ? (results ?? staticOptions) : staticOptions;\n\n return (\n <FormFieldFrame\n error={errors[errorKey]}\n helperText={props.helperText ?? undefined}\n tooltip={props.tooltip ?? undefined}\n label={props.label ?? \"\"}\n name={name}\n required={required}\n >\n {multiple ? (\n selected.map((value) => (\n <input key={value} name={`${domName}[]`} type=\"hidden\" value={value} />\n ))\n ) : (\n <input name={domName} type=\"hidden\" value={selected[0] ?? \"\"} />\n )}\n\n <div>\n {multiple && selected.length > 0 && (\n <div className=\"mb-1.5 flex flex-wrap gap-1\">\n {selected.map((value) => (\n <span\n className=\"inline-flex items-center gap-1 rounded-lt-sm bg-lt-muted px-2 py-0.5 text-xs\"\n key={value}\n >\n {labelFor(value)}\n {!locked && (\n <button\n aria-label={t(\"form.removeOption\", \"Remove {{label}}\", {\n label: labelFor(value),\n })}\n data-test={`select-${name}-remove-${value}`}\n className=\"text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-xs\"\n onClick={() => remove(value)}\n type=\"button\"\n >\n <Icon name=\"x\" />\n </button>\n )}\n </span>\n ))}\n </div>\n )}\n\n <Combobox\n emptyLabel={props.emptyLabel ?? undefined}\n loading={loading}\n multiple={multiple}\n onSearch={searchable ? search : undefined}\n onSelect={select}\n open={open && !locked}\n onOpenChange={(next) => {\n setOpen(next);\n\n if (!next) {\n blur(name);\n }\n }}\n options={options}\n searchPlaceholder={props.searchPlaceholder ?? undefined}\n selected={selected}\n testId={`select-${name}`}\n trigger={\n <>\n {!multiple && selected.length > 0 ? (\n <span>{labelFor(selected[0])}</span>\n ) : (\n <span className=\"text-lt-muted-fg\">{placeholder}</span>\n )}\n <Icon name=\"chevrons-up-down\" className=\"size-lt-icon-md shrink-0 text-lt-muted-fg\" />\n </>\n }\n triggerClassName={cn(\n controlSurface(),\n \"flex items-center justify-between gap-2 text-left\",\n locked && \"cursor-not-allowed opacity-60\",\n )}\n triggerProps={{\n \"aria-haspopup\": \"listbox\",\n autoFocus: props.autoFocus ?? undefined,\n \"data-test\": `select-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AM,WAAU;cAAoB;GAAkB,CAAA,GAExD,oBAAC,MAAD;IAAM,MAAK;IAAmB,WAAU;GAA6C,CAAA,CACrF,EAAA,CAAA;GAEJ,kBAAkB,GAChB,eAAe,GACf,qDACA,UAAU,+BACZ;GACA,cAAc;IACZ,iBAAiB;IACjB,WAAW,MAAM,aAAa,KAAA;IAC9B,aAAa,UAAU;IACvB,UAAU;IACV,UAAU,MAAM,YAAY,KAAA;GAC9B;EACD,CAAA,CACE,EAAA,CAAA,CACS;;AAEpB"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../../resources/js/form/components/fields/select.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport { Combobox } from \"@lattice-php/lattice/core/components/combobox\";\nimport { controlSurface } from \"@lattice-php/lattice/core/components/control\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { Option, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { FormFieldFrame } from \"../base/field\";\nimport { useFormContext } from \"../context\";\nimport { postFormAction } from \"../form-transport\";\nimport { useResolvedNode } from \"../resolved-nodes\";\nimport { useDependentField } from \"../use-dependent-field\";\nimport { useFieldCommit } from \"../use-field-commit\";\nimport { useFieldScope } from \"../field-scope\";\nimport { useFormValue, useFormValues } from \"../values\";\n\nfunction toValues(stored: unknown, fallback: unknown): string[] {\n const source = stored ?? fallback;\n\n if (Array.isArray(source)) {\n return source.map(String);\n }\n\n if (source === undefined || source === null || source === \"\") {\n return [];\n }\n\n return [String(source)];\n}\n\nexport const SelectComponent: RendererComponent<\"field.select\"> = ({ node }) => {\n const { t } = useT(\"lattice\");\n const props = node.props;\n const { action, componentRef, errors } = useFormContext();\n const { hidden, required, readOnly, disabled } = useDependentField(node);\n const { change, blur } = useFieldCommit();\n const resolvedNode = useResolvedNode(node);\n const name = props.name;\n const scope = useFieldScope();\n const domName = scope ? scope.scopedName(name) : name;\n const errorKey = scope ? scope.errorKey(name) : name;\n const searchKey = scope ? scope.errorKey(name) : name;\n const placeholder = props.placeholder || \"Select…\";\n const multiple = props.multiple;\n const searchable = props.searchable;\n const staticOptions = useMemo(\n () => (resolvedNode.props as { options?: Option[] }).options ?? [],\n [resolvedNode.props],\n );\n\n const globalValue = useFormValue(name);\n const values = useFormValues();\n const valuesRef = useRef(values);\n valuesRef.current = values;\n const storedValue = scope ? scope.getValue(name) : globalValue;\n const selected = useMemo(() => toValues(storedValue, props.value), [storedValue, props.value]);\n\n const [open, setOpen] = useState(false);\n const [results, setResults] = useState<Option[] | null>(null);\n const [loading, setLoading] = useState(false);\n const searchAbort = useRef<AbortController | null>(null);\n\n const labels = useMemo(() => {\n const map = new Map<string, string>();\n for (const option of [...staticOptions, ...(results ?? [])]) {\n map.set(option.value, option.label);\n }\n return map;\n }, [staticOptions, results]);\n const labelFor = (value: string) => labels.get(value) ?? value;\n\n const locked = readOnly || disabled;\n\n const search = useCallback(\n (query: string) => {\n searchAbort.current?.abort();\n\n if (query.trim() === \"\") {\n setResults(null);\n setLoading(false);\n\n return;\n }\n\n const controller = new AbortController();\n searchAbort.current = controller;\n setLoading(true);\n\n void postFormAction<{ options?: Option[] }>(\n action,\n componentRef,\n { ...valuesRef.current, _search: searchKey, q: query },\n controller.signal,\n )\n .then((response) => {\n setResults(response?.options ?? []);\n setLoading(false);\n })\n .catch(() => {});\n },\n [action, componentRef, searchKey],\n );\n\n function commit(next: string[]): void {\n change(name, multiple ? next : (next[0] ?? \"\"));\n }\n\n function select(value: string): void {\n if (multiple) {\n commit(\n selected.includes(value) ? selected.filter((item) => item !== value) : [...selected, value],\n );\n\n return;\n }\n\n commit([value]);\n }\n\n function remove(value: string): void {\n commit(selected.filter((item) => item !== value));\n }\n\n if (hidden) {\n return null;\n }\n\n const options = searchable ? (results ?? staticOptions) : staticOptions;\n\n return (\n <FormFieldFrame\n error={errors[errorKey]}\n helperText={props.helperText ?? undefined}\n tooltip={props.tooltip ?? undefined}\n label={props.label ?? \"\"}\n name={name}\n required={required}\n >\n {multiple ? (\n selected.map((value) => (\n <input key={value} name={`${domName}[]`} type=\"hidden\" value={value} />\n ))\n ) : (\n <input name={domName} type=\"hidden\" value={selected[0] ?? \"\"} />\n )}\n\n <div>\n {multiple && selected.length > 0 && (\n <div className=\"mb-1.5 flex flex-wrap gap-1\">\n {selected.map((value) => (\n <span\n className=\"inline-flex items-center gap-1 rounded-lt-sm bg-lt-muted px-2 py-0.5 text-xs\"\n key={value}\n >\n {labelFor(value)}\n {!locked && (\n <button\n aria-label={t(\"form.removeOption\", \"Remove {{label}}\", {\n label: labelFor(value),\n })}\n data-test={`select-${name}-remove-${value}`}\n className=\"text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-xs\"\n onClick={() => remove(value)}\n type=\"button\"\n >\n <Icon name=\"x\" />\n </button>\n )}\n </span>\n ))}\n </div>\n )}\n\n <Combobox\n emptyLabel={props.emptyLabel ?? undefined}\n loading={loading}\n multiple={multiple}\n onSearch={searchable ? search : undefined}\n onSelect={select}\n open={open && !locked}\n onOpenChange={(next) => {\n setOpen(next);\n\n if (!next) {\n blur(name);\n }\n }}\n options={options}\n searchPlaceholder={props.searchPlaceholder ?? undefined}\n showSearch={Boolean(searchable)}\n selected={selected}\n testId={`select-${name}`}\n trigger={\n <>\n {!multiple && selected.length > 0 ? (\n <span>{labelFor(selected[0])}</span>\n ) : (\n <span className=\"text-lt-muted-fg\">{placeholder}</span>\n )}\n <Icon name=\"chevrons-up-down\" className=\"size-lt-icon-md shrink-0 text-lt-muted-fg\" />\n </>\n }\n triggerClassName={cn(\n controlSurface(),\n \"flex items-center justify-between gap-2 text-left\",\n locked && \"cursor-not-allowed opacity-60\",\n )}\n triggerProps={{\n \"aria-haspopup\": \"listbox\",\n autoFocus: props.autoFocus ?? undefined,\n \"data-test\": `select-${name}`,\n disabled: locked,\n tabIndex: props.tabIndex ?? undefined,\n }}\n />\n </div>\n </FormF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AAC,MAAD;IAAM,MAAK;IAAmB,WAAU;GAA6C,CAAA,CACrF,EAAA,CAAA;GAEJ,kBAAkB,GAChB,eAAe,GACf,qDACA,UAAU,+BACZ;GACA,cAAc;IACZ,iBAAiB;IACjB,WAAW,MAAM,aAAa,KAAA;IAC9B,aAAa,UAAU;IACvB,UAAU;IACV,UAAU,MAAM,YAAY,KAAA;GAC9B;EACD,CAAA,CACE,EAAA,CAAA,CACS;;AAEpB"}
@@ -3,8 +3,8 @@ import { testIdentity } from "../../../core/test-id.js";
3
3
  import { useFormContext } from "../context.js";
4
4
  import { useFieldScope } from "../field-scope.js";
5
5
  import { useFormValue } from "../values.js";
6
- import { toBoolean } from "../conditions.js";
7
6
  import { FormFieldFrame } from "../base/field.js";
7
+ import { toBoolean } from "../conditions.js";
8
8
  import { useDependentField } from "../use-dependent-field.js";
9
9
  import { useFieldCommit } from "../use-field-commit.js";
10
10
  import { useSeedDefault } from "../use-seed-default.js";
@@ -1,10 +1,10 @@
1
- import { FormComponent } from "./form.js";
2
1
  import { BuilderComponent } from "./fields/builder.js";
3
2
  import { CheckboxComponent } from "./fields/checkbox.js";
4
3
  import { ChoiceComponent } from "./fields/choice.js";
5
4
  import { DateInputComponent } from "./fields/date-input.js";
6
5
  import { DateTimeInputComponent } from "./fields/date-time-input.js";
7
6
  import { FileUploadComponent } from "./fields/file-upload.js";
7
+ import { FormComponent } from "./form.js";
8
8
  import { HiddenInputComponent } from "./fields/hidden-input.js";
9
9
  import { NumberInputComponent } from "./fields/number-input.js";
10
10
  import { OtpInputComponent } from "./fields/otp-input.js";
@@ -0,0 +1 @@
1
+ export declare const eagerFormComponents: import('../core/registry').Plugin;
@@ -0,0 +1,47 @@
1
+ import { createPlugin, eagerComponent } from "../core/registry.js";
2
+ import { BuilderComponent } from "./components/fields/builder.js";
3
+ import { CheckboxComponent } from "./components/fields/checkbox.js";
4
+ import { ChoiceComponent } from "./components/fields/choice.js";
5
+ import { DateInputComponent } from "./components/fields/date-input.js";
6
+ import { DateTimeInputComponent } from "./components/fields/date-time-input.js";
7
+ import { FileUploadComponent } from "./components/fields/file-upload.js";
8
+ import { FormComponent } from "./components/form.js";
9
+ import { HiddenInputComponent } from "./components/fields/hidden-input.js";
10
+ import { NumberInputComponent } from "./components/fields/number-input.js";
11
+ import { OtpInputComponent } from "./components/fields/otp-input.js";
12
+ import { PasswordInputComponent } from "./components/fields/password-input.js";
13
+ import { RepeaterComponent } from "./components/fields/repeater.js";
14
+ import { SelectComponent } from "./components/fields/select.js";
15
+ import { TextareaComponent } from "./components/fields/textarea.js";
16
+ import { TextInputComponent } from "./components/fields/text-input.js";
17
+ import { TimeInputComponent } from "./components/fields/time-input.js";
18
+ import { ToggleComponent } from "./components/fields/toggle.js";
19
+ import { RichEditorComponent } from "./components/fields/rich-editor.js";
20
+ //#region resources/js/form/eager.ts
21
+ var eagerFormComponents = createPlugin({
22
+ components: {
23
+ form: eagerComponent(FormComponent),
24
+ "field.builder": eagerComponent(BuilderComponent),
25
+ "field.checkbox": eagerComponent(CheckboxComponent),
26
+ "field.choice": eagerComponent(ChoiceComponent),
27
+ "field.date-input": eagerComponent(DateInputComponent),
28
+ "field.date-time-input": eagerComponent(DateTimeInputComponent),
29
+ "field.file-upload": eagerComponent(FileUploadComponent),
30
+ "field.hidden-input": eagerComponent(HiddenInputComponent),
31
+ "field.number-input": eagerComponent(NumberInputComponent),
32
+ "field.otp": eagerComponent(OtpInputComponent),
33
+ "field.password-input": eagerComponent(PasswordInputComponent),
34
+ "field.repeater": eagerComponent(RepeaterComponent),
35
+ "field.rich-editor": eagerComponent(RichEditorComponent),
36
+ "field.select": eagerComponent(SelectComponent),
37
+ "field.textarea": eagerComponent(TextareaComponent),
38
+ "field.text-input": eagerComponent(TextInputComponent),
39
+ "field.time-input": eagerComponent(TimeInputComponent),
40
+ "field.toggle": eagerComponent(ToggleComponent)
41
+ },
42
+ name: "lattice/form"
43
+ });
44
+ //#endregion
45
+ export { eagerFormComponents };
46
+
47
+ //# sourceMappingURL=eager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eager.js","names":[],"sources":["../../resources/js/form/eager.ts"],"sourcesContent":["import { createPlugin, eagerComponent } from \"@lattice-php/lattice/core/registry\";\nimport {\n BuilderComponent,\n CheckboxComponent,\n ChoiceComponent,\n DateInputComponent,\n DateTimeInputComponent,\n FileUploadComponent,\n FormComponent,\n HiddenInputComponent,\n NumberInputComponent,\n OtpInputComponent,\n PasswordInputComponent,\n RepeaterComponent,\n SelectComponent,\n TextareaComponent,\n TextInputComponent,\n TimeInputComponent,\n ToggleComponent,\n} from \"./components\";\nimport { RichEditorComponent } from \"./components/fields/rich-editor\";\n\nexport const eagerFormComponents = createPlugin({\n components: {\n form: eagerComponent(FormComponent),\n \"field.builder\": eagerComponent(BuilderComponent),\n \"field.checkbox\": eagerComponent(CheckboxComponent),\n \"field.choice\": eagerComponent(ChoiceComponent),\n \"field.date-input\": eagerComponent(DateInputComponent),\n \"field.date-time-input\": eagerComponent(DateTimeInputComponent),\n \"field.file-upload\": eagerComponent(FileUploadComponent),\n \"field.hidden-input\": eagerComponent(HiddenInputComponent),\n \"field.number-input\": eagerComponent(NumberInputComponent),\n \"field.otp\": eagerComponent(OtpInputComponent),\n \"field.password-input\": eagerComponent(PasswordInputComponent),\n \"field.repeater\": eagerComponent(RepeaterComponent),\n \"field.rich-editor\": eagerComponent(RichEditorComponent),\n \"field.select\": eagerComponent(SelectComponent),\n \"field.textarea\": eagerComponent(TextareaComponent),\n \"field.text-input\": eagerComponent(TextInputComponent),\n \"field.time-input\": eagerComponent(TimeInputComponent),\n \"field.toggle\": eagerComponent(ToggleComponent),\n },\n name: \"lattice/form\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,sBAAsB,aAAa;CAC9C,YAAY;EACV,MAAM,eAAe,aAAa;EAClC,iBAAiB,eAAe,gBAAgB;EAChD,kBAAkB,eAAe,iBAAiB;EAClD,gBAAgB,eAAe,eAAe;EAC9C,oBAAoB,eAAe,kBAAkB;EACrD,yBAAyB,eAAe,sBAAsB;EAC9D,qBAAqB,eAAe,mBAAmB;EACvD,sBAAsB,eAAe,oBAAoB;EACzD,sBAAsB,eAAe,oBAAoB;EACzD,aAAa,eAAe,iBAAiB;EAC7C,wBAAwB,eAAe,sBAAsB;EAC7D,kBAAkB,eAAe,iBAAiB;EAClD,qBAAqB,eAAe,mBAAmB;EACvD,gBAAgB,eAAe,eAAe;EAC9C,kBAAkB,eAAe,iBAAiB;EAClD,oBAAoB,eAAe,kBAAkB;EACrD,oBAAoB,eAAe,kBAAkB;EACrD,gBAAgB,eAAe,eAAe;CAChD;CACA,MAAM;AACR,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { registry } from './registry';
1
+ export { lazyRegistry, registry } from './registry';
2
2
  export { useChat } from './chat/use-chat';
3
3
  export { chatPlugin } from './chat';
4
4
  export { getActionEffects, isActionEffect, dispatchEffects, dispatchActionError, } from './effects/dispatch';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { initializeTheme, updateAppearance, useAppearance } from "./appearance/index.js";
2
+ import { useColumnRegistry, useComponentRegistry } from "./core/registry-context.js";
2
3
  import { LATTICE_EVENT } from "./events/event-names.js";
3
4
  import { LATTICE_REF_HEADER, withRefHeader } from "./core/component-ref.js";
4
5
  import { withHeaders } from "./core/headers.js";
5
6
  import { Icon, SpriteProvider } from "./icons/sprite.js";
6
7
  import { IconRenderer, IconRendererProvider } from "./icons/icon-renderer.js";
7
8
  import { CollapsedContext, useCollapsed } from "./core/collapsed-context.js";
8
- import { useColumnRegistry, useComponentRegistry } from "./core/registry-context.js";
9
9
  import { Renderer } from "./core/renderer.js";
10
10
  import { onToast, showToast } from "./toast/toast.js";
11
11
  import { onCallout } from "./toast/callout.js";
@@ -20,12 +20,12 @@ import { layoutComponents } from "./layout/components.js";
20
20
  import SchemaLayout from "./layout/schema-layout.js";
21
21
  import { RealtimeListeners } from "./realtime/listeners.js";
22
22
  import { createLayoutResolver, createPageResolver, pageComponentName, withVisitHeaders } from "./inertia.js";
23
+ import { Toaster } from "./toast/toaster.js";
23
24
  import { useChat } from "./chat/use-chat.js";
24
25
  import { chatPlugin } from "./chat/index.js";
25
26
  import { copyToClipboard, useClipboard } from "./clipboard/index.js";
26
- import { registry } from "./registry.js";
27
- import { Toaster } from "./toast/toaster.js";
28
- import { Provider } from "./provider.js";
27
+ import { lazyRegistry } from "./registry/lazy.js";
29
28
  import { createLatticeApp } from "./create-app.js";
29
+ import { Provider } from "./provider.js";
30
30
  import { columnCell } from "./table/registry.js";
31
- export { Callouts, EventBridge, Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, OutletContext, Provider, RealtimeListeners, Renderer, SchemaLayout, CollapsedContext as SidebarCollapsedContext, SpriteProvider, Toaster, builtinEffectHandlers, chatPlugin, columnCell, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createPlugin, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects, initializeTheme, isActionEffect, layoutComponents, lazyComponent, mergeEffectHandlers, onCallout, onToast, pageComponentName, registry, showToast, updateAppearance, useAppearance, useChat, useClipboard, useColumnRegistry, useComponentRegistry, useEffectDispatcher, useCollapsed as useSidebarCollapsed, withHeaders, withRefHeader, withVisitHeaders };
31
+ export { Callouts, EventBridge, Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, OutletContext, Provider, RealtimeListeners, Renderer, SchemaLayout, CollapsedContext as SidebarCollapsedContext, SpriteProvider, Toaster, builtinEffectHandlers, chatPlugin, columnCell, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createPlugin, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects, initializeTheme, isActionEffect, layoutComponents, lazyComponent, lazyRegistry, mergeEffectHandlers, onCallout, onToast, pageComponentName, lazyRegistry as registry, showToast, updateAppearance, useAppearance, useChat, useClipboard, useColumnRegistry, useComponentRegistry, useEffectDispatcher, useCollapsed as useSidebarCollapsed, withHeaders, withRefHeader, withVisitHeaders };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { Registry } from './core/registry';
3
+ import { SpriteValue } from './icons/sprite';
4
+ export type ProviderBaseProps = {
5
+ children: ReactNode;
6
+ registry: Registry;
7
+ sprite?: SpriteValue;
8
+ toaster?: boolean;
9
+ };
10
+ export declare function ProviderBase({ children, registry, sprite, toaster, }: ProviderBaseProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { updateAppearance } from "./appearance/index.js";
2
+ import { RegistryContext } from "./core/registry-context.js";
3
+ import { SpriteProvider } from "./icons/sprite.js";
4
+ import { EventBridge } from "./events/event-bridge.js";
5
+ import { useFlashEffects } from "./effects/use-flash-effects.js";
6
+ import { Toaster } from "./toast/toaster.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region resources/js/provider-base.tsx
9
+ var defaultSprite = { href: "" };
10
+ function ProviderBase({ children, registry, sprite = defaultSprite, toaster = true }) {
11
+ useFlashEffects();
12
+ return /* @__PURE__ */ jsx(RegistryContext.Provider, {
13
+ value: registry,
14
+ children: /* @__PURE__ */ jsxs(SpriteProvider, {
15
+ sprite,
16
+ children: [
17
+ children,
18
+ /* @__PURE__ */ jsx(EventBridge, { onAppearanceChange: updateAppearance }),
19
+ toaster ? /* @__PURE__ */ jsx(Toaster, {}) : null
20
+ ]
21
+ })
22
+ });
23
+ }
24
+ //#endregion
25
+ export { ProviderBase };
26
+
27
+ //# sourceMappingURL=provider-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-base.js","names":[],"sources":["../resources/js/provider-base.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { Registry } from \"./core/registry\";\nimport { RegistryContext } from \"./core/registry-context\";\nimport { useFlashEffects } from \"./effects/use-flash-effects\";\nimport { EventBridge } from \"./events/event-bridge\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport { SpriteProvider } from \"./icons/sprite\";\nimport { Toaster } from \"./toast\";\nimport { updateAppearance } from \"./appearance\";\n\nconst defaultSprite: SpriteValue = { href: \"\" };\n\nexport type ProviderBaseProps = {\n children: ReactNode;\n registry: Registry;\n sprite?: SpriteValue;\n toaster?: boolean;\n};\n\nexport function ProviderBase({\n children,\n registry,\n sprite = defaultSprite,\n toaster = true,\n}: ProviderBaseProps) {\n useFlashEffects();\n\n return (\n <RegistryContext.Provider value={registry}>\n <SpriteProvider sprite={sprite}>\n {children}\n <EventBridge onAppearanceChange={updateAppearance} />\n {toaster ? <Toaster /> : null}\n </SpriteProvider>\n </RegistryContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,gBAA6B,EAAE,MAAM,GAAG;AAS9C,SAAgB,aAAa,EAC3B,UACA,UACA,SAAS,eACT,UAAU,QACU;CACpB,gBAAgB;CAEhB,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;YAC/B,qBAAC,gBAAD;GAAwB;aAAxB;IACG;IACD,oBAAC,aAAD,EAAa,oBAAoB,iBAAmB,CAAA;IACnD,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI;GACX;;CACQ,CAAA;AAE9B"}
@@ -1,10 +1,7 @@
1
- import { ReactNode } from 'react';
2
- import { SpriteValue } from './icons/sprite';
3
1
  import { Registry } from './core/registry';
4
- export declare function Provider({ children, registry, sprite, toaster, }: {
5
- children: ReactNode;
2
+ import { ProviderBaseProps } from './provider-base';
3
+ type ProviderProps = Omit<ProviderBaseProps, "registry"> & {
6
4
  registry?: Registry;
7
- sprite?: SpriteValue;
8
- toaster?: boolean;
9
- }): import("react").JSX.Element;
5
+ };
6
+ export declare function Provider({ registry, ...props }: ProviderProps): import("react").JSX.Element;
10
7
  export { useComponentRegistry, useColumnRegistry, useEffectHandlerRegistry, } from './core/registry-context';
package/dist/provider.js CHANGED
@@ -1,26 +1,13 @@
1
- import { updateAppearance } from "./appearance/index.js";
2
- import { SpriteProvider } from "./icons/sprite.js";
3
- import { RegistryContext, setDefaultRegistry, useColumnRegistry, useComponentRegistry, useEffectHandlerRegistry } from "./core/registry-context.js";
4
- import { EventBridge } from "./events/event-bridge.js";
5
- import { registry } from "./registry.js";
6
- import { Toaster } from "./toast/toaster.js";
7
- import { useFlashEffects } from "./effects/use-flash-effects.js";
8
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { setDefaultRegistry, useColumnRegistry, useComponentRegistry, useEffectHandlerRegistry } from "./core/registry-context.js";
2
+ import { ProviderBase } from "./provider-base.js";
3
+ import { lazyRegistry } from "./registry/lazy.js";
4
+ import { jsx } from "react/jsx-runtime";
9
5
  //#region resources/js/provider.tsx
10
- setDefaultRegistry(registry);
11
- var defaultSprite = { href: "" };
12
- function Provider({ children, registry: registry$1 = registry, sprite = defaultSprite, toaster = true }) {
13
- useFlashEffects();
14
- return /* @__PURE__ */ jsx(RegistryContext.Provider, {
15
- value: registry$1,
16
- children: /* @__PURE__ */ jsxs(SpriteProvider, {
17
- sprite,
18
- children: [
19
- children,
20
- /* @__PURE__ */ jsx(EventBridge, { onAppearanceChange: updateAppearance }),
21
- toaster ? /* @__PURE__ */ jsx(Toaster, {}) : null
22
- ]
23
- })
6
+ setDefaultRegistry(lazyRegistry);
7
+ function Provider({ registry = lazyRegistry, ...props }) {
8
+ return /* @__PURE__ */ jsx(ProviderBase, {
9
+ ...props,
10
+ registry
24
11
  });
25
12
  }
26
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","names":[],"sources":["../resources/js/provider.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport { SpriteProvider } from \"./icons/sprite\";\nimport { registry as defaultRegistry } from \"./registry\";\nimport type { Registry } from \"./core/registry\";\nimport { RegistryContext, setDefaultRegistry } from \"./core/registry-context\";\nimport { Toaster } from \"./toast\";\nimport { updateAppearance } from \"./appearance\";\nimport { EventBridge } from \"./events/event-bridge\";\nimport { useFlashEffects } from \"./effects/use-flash-effects\";\n\n// Register the default registry so selectors work outside <Provider>.\n// This module is always loaded after registry.ts finishes, so defaultRegistry\n// is guaranteed to be defined here.\nsetDefaultRegistry(defaultRegistry);\n\nconst defaultSprite: SpriteValue = { href: \"\" };\n\nexport function Provider({\n children,\n registry = defaultRegistry,\n sprite = defaultSprite,\n toaster = true,\n}: {\n children: ReactNode;\n registry?: Registry;\n sprite?: SpriteValue;\n toaster?: boolean;\n}) {\n useFlashEffects();\n\n return (\n <RegistryContext.Provider value={registry}>\n <SpriteProvider sprite={sprite}>\n {children}\n <EventBridge onAppearanceChange={updateAppearance} />\n {toaster ? <Toaster /> : null}\n </SpriteProvider>\n </RegistryContext.Provider>\n );\n}\n\nexport {\n useComponentRegistry,\n useColumnRegistry,\n useEffectHandlerRegistry,\n} from \"./core/registry-context\";\n"],"mappings":";;;;;;;;;AAcA,mBAAmB,QAAe;AAElC,IAAM,gBAA6B,EAAE,MAAM,GAAG;AAE9C,SAAgB,SAAS,EACvB,UACA,UAAA,aAAW,UACX,SAAS,eACT,UAAU,QAMT;CACD,gBAAgB;CAEhB,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;YAC/B,qBAAC,gBAAD;GAAwB;aAAxB;IACG;IACD,oBAAC,aAAD,EAAa,oBAAoB,iBAAmB,CAAA;IACnD,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI;GACX;;CACQ,CAAA;AAE9B"}
1
+ {"version":3,"file":"provider.js","names":[],"sources":["../resources/js/provider.tsx"],"sourcesContent":["import { registry as defaultRegistry } from \"./registry\";\nimport type { Registry } from \"./core/registry\";\nimport { setDefaultRegistry } from \"./core/registry-context\";\nimport { ProviderBase, type ProviderBaseProps } from \"./provider-base\";\n\n// Register the default registry so selectors work outside <Provider>.\n// This module is always loaded after registry.ts finishes, so defaultRegistry\n// is guaranteed to be defined here.\nsetDefaultRegistry(defaultRegistry);\n\ntype ProviderProps = Omit<ProviderBaseProps, \"registry\"> & {\n registry?: Registry;\n};\n\nexport function Provider({ registry = defaultRegistry, ...props }: ProviderProps) {\n return <ProviderBase {...props} registry={registry} />;\n}\n\nexport {\n useComponentRegistry,\n useColumnRegistry,\n useEffectHandlerRegistry,\n} from \"./core/registry-context\";\n"],"mappings":";;;;;AAQA,mBAAmB,YAAe;AAMlC,SAAgB,SAAS,EAAE,WAAW,cAAiB,GAAG,SAAwB;CAChF,OAAO,oBAAC,cAAD;EAAc,GAAI;EAAiB;CAAW,CAAA;AACvD"}
@@ -0,0 +1 @@
1
+ export declare const eagerRegistry: import('../core/registry').Registry;
@@ -0,0 +1,14 @@
1
+ import { createRegistry } from "../core/registry.js";
2
+ import { layoutComponents } from "../layout/components.js";
3
+ import { actionComponents } from "../action/index.js";
4
+ import { chatPlugin } from "../chat/index.js";
5
+ import { remoteComponents } from "../remote/index.js";
6
+ import { eagerFormComponents } from "../form/eager.js";
7
+ import { eagerCoreComponents } from "../core/components/eager.js";
8
+ import { eagerTableComponents } from "../table/eager.js";
9
+ //#region resources/js/registry/eager.ts
10
+ var eagerRegistry = createRegistry(eagerCoreComponents, actionComponents, eagerFormComponents, layoutComponents, eagerTableComponents, chatPlugin, remoteComponents);
11
+ //#endregion
12
+ export { eagerRegistry };
13
+
14
+ //# sourceMappingURL=eager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eager.js","names":[],"sources":["../../resources/js/registry/eager.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/lattice/core/registry\";\nimport { actionComponents } from \"../action\";\nimport { chatPlugin } from \"../chat\";\nimport { eagerCoreComponents } from \"../core/components/eager\";\nimport { eagerFormComponents } from \"../form/eager\";\nimport { layoutComponents } from \"../layout/components\";\nimport { remoteComponents } from \"../remote\";\nimport { eagerTableComponents } from \"../table/eager\";\n\nexport const eagerRegistry = createRegistry(\n eagerCoreComponents,\n actionComponents,\n eagerFormComponents,\n layoutComponents,\n eagerTableComponents,\n chatPlugin,\n remoteComponents,\n);\n"],"mappings":";;;;;;;;;AASA,IAAa,gBAAgB,eAC3B,qBACA,kBACA,qBACA,kBACA,sBACA,YACA,gBACF"}
@@ -0,0 +1 @@
1
+ export declare const lazyRegistry: import('../core/registry').Registry;
@@ -0,0 +1,14 @@
1
+ import { createRegistry } from "../core/registry.js";
2
+ import { layoutComponents } from "../layout/components.js";
3
+ import { actionComponents } from "../action/index.js";
4
+ import { chatPlugin } from "../chat/index.js";
5
+ import { coreComponents } from "../core/components/index.js";
6
+ import { formComponents } from "../form/index.js";
7
+ import { remoteComponents } from "../remote/index.js";
8
+ import { tableComponents } from "../table/index.js";
9
+ //#region resources/js/registry/lazy.ts
10
+ var lazyRegistry = createRegistry(coreComponents, actionComponents, formComponents, layoutComponents, tableComponents, chatPlugin, remoteComponents);
11
+ //#endregion
12
+ export { lazyRegistry };
13
+
14
+ //# sourceMappingURL=lazy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy.js","names":[],"sources":["../../resources/js/registry/lazy.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/lattice/core/registry\";\nimport { actionComponents } from \"../action\";\nimport { chatPlugin } from \"../chat\";\nimport { coreComponents } from \"../core/components\";\nimport { formComponents } from \"../form\";\nimport { layoutComponents } from \"../layout/components\";\nimport { remoteComponents } from \"../remote\";\nimport { tableComponents } from \"../table\";\n\nexport const lazyRegistry = createRegistry(\n coreComponents,\n actionComponents,\n formComponents,\n layoutComponents,\n tableComponents,\n chatPlugin,\n remoteComponents,\n);\n"],"mappings":";;;;;;;;;AASA,IAAa,eAAe,eAC1B,gBACA,kBACA,gBACA,kBACA,iBACA,YACA,gBACF"}
@@ -1 +1 @@
1
- export declare const registry: import('./core/registry').Registry;
1
+ export { lazyRegistry, lazyRegistry as registry } from './registry/lazy';
package/dist/registry.js CHANGED
@@ -1,14 +1,2 @@
1
- import { createRegistry } from "./core/registry.js";
2
- import { layoutComponents } from "./layout/components.js";
3
- import { actionComponents } from "./action/index.js";
4
- import { chatPlugin } from "./chat/index.js";
5
- import { coreComponents } from "./core/components/index.js";
6
- import { formComponents } from "./form/index.js";
7
- import { remoteComponents } from "./remote/index.js";
8
- import { tableComponents } from "./table/index.js";
9
- //#region resources/js/registry.ts
10
- var registry = createRegistry(coreComponents, actionComponents, formComponents, layoutComponents, tableComponents, chatPlugin, remoteComponents);
11
- //#endregion
12
- export { registry };
13
-
14
- //# sourceMappingURL=registry.js.map
1
+ import { lazyRegistry } from "./registry/lazy.js";
2
+ export { lazyRegistry, lazyRegistry as registry };
@@ -1,9 +1,9 @@
1
1
  import { cn } from "../../lib/utils.js";
2
2
  import { Icon } from "../../icons/sprite.js";
3
3
  import { useT } from "../../i18n/instance.js";
4
- import { filterOptions, stringProp } from "../filter-values.js";
5
4
  import { Checkbox } from "../../core/components/checkbox.js";
6
5
  import { Combobox } from "../../core/components/combobox.js";
6
+ import { filterOptions, stringProp } from "../filter-values.js";
7
7
  import { fieldClass } from "./filter-value-input.js";
8
8
  import { useState } from "react";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -4,13 +4,13 @@ import { useT } from "../../i18n/instance.js";
4
4
  import { nodeIdentity } from "../../core/test-id.js";
5
5
  import { useColumnResizing } from "../../core/use-column-resizing.js";
6
6
  import { useColumnVisibility } from "../../core/use-column-visibility.js";
7
+ import { Checkbox } from "../../core/components/checkbox.js";
7
8
  import { alignJustifyItems, alignText } from "../align.js";
8
9
  import { getBulkActions } from "../bulk.js";
9
10
  import { flattenColumns, getRowActions, getRowKey } from "../payload.js";
10
11
  import { getQueryParams, getTableSizingColumns, getTableUtilityTracks, getVisiblePages } from "../query.js";
11
- import { useTableSelection } from "../use-table-selection.js";
12
12
  import { useTable } from "../use-table.js";
13
- import { Checkbox } from "../../core/components/checkbox.js";
13
+ import { useTableSelection } from "../use-table-selection.js";
14
14
  import { BulkBar } from "./bulk-bar.js";
15
15
  import { ColumnFilterControl } from "./column-filter-control.js";
16
16
  import { ColumnHeader } from "./column-header.js";
@@ -0,0 +1 @@
1
+ export declare const eagerTableComponents: import('../core/registry').Plugin;
@@ -0,0 +1,11 @@
1
+ import { createPlugin, eagerComponent } from "../core/registry.js";
2
+ import TableComponent from "./components/table.js";
3
+ //#region resources/js/table/eager.ts
4
+ var eagerTableComponents = createPlugin({
5
+ components: { table: eagerComponent(TableComponent) },
6
+ name: "lattice/table"
7
+ });
8
+ //#endregion
9
+ export { eagerTableComponents };
10
+
11
+ //# sourceMappingURL=eager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eager.js","names":[],"sources":["../../resources/js/table/eager.ts"],"sourcesContent":["import { createPlugin, eagerComponent } from \"@lattice-php/lattice/core/registry\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport TableComponent from \"./components/table\";\n\nexport const eagerTableComponents = createPlugin({\n components: {\n table: eagerComponent(TableComponent as unknown as RendererComponent<\"table\">),\n },\n name: \"lattice/table\",\n});\n"],"mappings":";;;AAIA,IAAa,uBAAuB,aAAa;CAC/C,YAAY,EACV,OAAO,eAAe,cAAuD,EAC/E;CACA,MAAM;AACR,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { LATTICE_EVENT } from "../events/event-names.js";
2
2
  import { apiFetch, apiJson } from "../core/api.js";
3
- import { isEmptyFilterValue } from "./filter-values.js";
4
3
  import { getColumns, getPagination, getRows, getState } from "./payload.js";
4
+ import { isEmptyFilterValue } from "./filter-values.js";
5
5
  import { buildEndpoint, nextSort } from "./query.js";
6
6
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
7
  //#region resources/js/table/use-table.ts
@@ -123,6 +123,7 @@ export type Callouts = Record<string, never>;
123
123
  export type Card = {
124
124
  description: string | null;
125
125
  title: string | null;
126
+ tooltip: string | null;
126
127
  };
127
128
  export type ChannelVisibility = "public" | "private" | "presence";
128
129
  export type Chart = {
@@ -231,6 +232,7 @@ export type CloseModalEffect = {
231
232
  export type Collapsible = {
232
233
  collapsed: boolean;
233
234
  rememberState: boolean;
235
+ tooltip: string | null;
234
236
  trigger: Node[];
235
237
  };
236
238
  export type Color = "default" | "muted" | "primary" | "success" | "info" | "warning" | "danger";
@@ -372,6 +374,10 @@ export type CoreNode = {
372
374
  type: "text";
373
375
  key?: string;
374
376
  props: Text;
377
+ } | {
378
+ type: "tooltip";
379
+ key?: string;
380
+ props: Tooltip;
375
381
  };
376
382
  export type DataList = {
377
383
  dataEndpoint: string | null;
@@ -635,6 +641,7 @@ export type Grid = {
635
641
  export type Heading = {
636
642
  level: number;
637
643
  text: string;
644
+ tooltip: string | null;
638
645
  };
639
646
  export type Height = "full" | "screen";
640
647
  export type HiddenInput = {
@@ -981,6 +988,7 @@ export type Section = {
981
988
  headerActions: Node[];
982
989
  rememberState: boolean;
983
990
  title: string | null;
991
+ tooltip: string | null;
984
992
  };
985
993
  export type SegmentedControl = {
986
994
  emits: string | null;
@@ -1248,6 +1256,10 @@ export type ToolCallPart = {
1248
1256
  args: Record<string, unknown>;
1249
1257
  name: string;
1250
1258
  };
1259
+ export type Tooltip = {
1260
+ content: string | null;
1261
+ trigger: Node[];
1262
+ };
1251
1263
  export type Topbar = {
1252
1264
  sticky: boolean;
1253
1265
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lattice-php/lattice",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Server-driven React components for Laravel and Inertia.",
5
5
  "license": "MIT",
6
6
  "author": "Manuel Christlieb <manuel@christlieb.eu>",
@@ -135,6 +135,14 @@
135
135
  "types": "./dist/registry.d.ts",
136
136
  "import": "./dist/registry.js"
137
137
  },
138
+ "./registry/eager": {
139
+ "types": "./dist/registry/eager.d.ts",
140
+ "import": "./dist/registry/eager.js"
141
+ },
142
+ "./registry/lazy": {
143
+ "types": "./dist/registry/lazy.d.ts",
144
+ "import": "./dist/registry/lazy.js"
145
+ },
138
146
  "./remote": {
139
147
  "types": "./dist/remote/index.d.ts",
140
148
  "import": "./dist/remote/index.js"
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","names":[],"sources":["../resources/js/registry.ts"],"sourcesContent":["import { createRegistry } from \"@lattice-php/lattice/core/registry\";\nimport { actionComponents } from \"./action\";\nimport { chatPlugin } from \"./chat\";\nimport { coreComponents } from \"./core/components\";\nimport { formComponents } from \"./form\";\nimport { remoteComponents } from \"./remote\";\nimport { layoutComponents } from \"./layout/components\";\nimport { tableComponents } from \"./table\";\n\nexport const registry = createRegistry(\n coreComponents,\n actionComponents,\n formComponents,\n layoutComponents,\n tableComponents,\n chatPlugin,\n remoteComponents,\n);\n"],"mappings":";;;;;;;;;AASA,IAAa,WAAW,eACtB,gBACA,kBACA,gBACA,kBACA,iBACA,YACA,gBACF"}