@lattice-php/lattice 0.61.0 → 0.63.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 (99) hide show
  1. package/dist/create-app.js +3 -2
  2. package/dist/create-app.js.map +1 -1
  3. package/dist/event-bridge.js +1 -1
  4. package/dist/fragments/fragment.js +1 -1
  5. package/dist/index.d.ts +1 -3
  6. package/dist/index.js +3 -7
  7. package/dist/inertia-navigation.d.ts +6 -0
  8. package/dist/inertia-navigation.js +28 -4
  9. package/dist/inertia-navigation.js.map +1 -1
  10. package/dist/lattice.css +16 -0
  11. package/dist/layout/components/outlet.js.map +1 -1
  12. package/dist/layout/components/schema-layout.js +1 -1
  13. package/dist/layout/components/schema-layout.js.map +1 -1
  14. package/dist/layout/index.d.ts +0 -1
  15. package/dist/layout/index.js +1 -2
  16. package/dist/layout/plugin.js +1 -19
  17. package/dist/layout/plugin.js.map +1 -1
  18. package/dist/notifications/components/empty-state.js +1 -1
  19. package/dist/notifications/components/notification-item.js +3 -3
  20. package/dist/notifications/components/notification-item.js.map +1 -1
  21. package/dist/notifications/components/notification-list.js +1 -1
  22. package/dist/notifications/components/notification-list.js.map +1 -1
  23. package/dist/notifications/components/notifications-echo.js.map +1 -1
  24. package/dist/notifications/components/notifications-sheet.js +2 -2
  25. package/dist/notifications/components/notifications-sheet.js.map +1 -1
  26. package/dist/notifications/components/notifications.js +4 -4
  27. package/dist/notifications/components/notifications.js.map +1 -1
  28. package/dist/page.js +2 -1
  29. package/dist/page.js.map +1 -1
  30. package/dist/provider-base.d.ts +3 -1
  31. package/dist/provider-base.js +6 -5
  32. package/dist/provider-base.js.map +1 -1
  33. package/dist/realtime/subscriptions.js +3 -3
  34. package/dist/realtime/subscriptions.js.map +1 -1
  35. package/dist/remote/components/data-list.js +1 -1
  36. package/dist/runtime.d.ts +4 -4
  37. package/dist/runtime.js +6 -9
  38. package/dist/types/generated.d.ts +4 -38
  39. package/dist/vite.d.ts +12 -1
  40. package/dist/vite.js +27 -2
  41. package/dist/vite.js.map +1 -1
  42. package/dist-standalone/chunks/chart-view-DDMYuMfl.js +59 -0
  43. package/dist-standalone/chunks/{date-picker-field-B09aCbOL.js → date-picker-view-C900j9vx.js} +1 -1
  44. package/dist-standalone/chunks/dist-Dd8dg4q5.js +106 -0
  45. package/dist-standalone/chunks/{field-rjVaymdj.js → pattern-input-view-fft15W-u.js} +1 -1
  46. package/dist-standalone/chunks/rich-editor-view-NSVl9YGe.js +53 -0
  47. package/dist-standalone/chunks/runtime-2lXh8My2.js +162 -0
  48. package/dist-standalone/chunks/{subscriptions-P9PiNr3N.js → subscriptions-C7Y-lvpC.js} +1 -1
  49. package/dist-standalone/lattice.css +1 -1
  50. package/dist-standalone/lattice.js +1 -1
  51. package/dist-standalone/manifest.json +1 -1
  52. package/dist-standalone/runtime.js +1 -1
  53. package/dist-standalone/sprite.svg +1 -1
  54. package/package.json +7 -12
  55. package/dist/layout/components/breadcrumbs.d.ts +0 -3
  56. package/dist/layout/components/breadcrumbs.js +0 -41
  57. package/dist/layout/components/breadcrumbs.js.map +0 -1
  58. package/dist/layout/components/callouts.d.ts +0 -15
  59. package/dist/layout/components/callouts.js +0 -89
  60. package/dist/layout/components/callouts.js.map +0 -1
  61. package/dist/layout/components/dropdown.d.ts +0 -3
  62. package/dist/layout/components/dropdown.js +0 -24
  63. package/dist/layout/components/dropdown.js.map +0 -1
  64. package/dist/layout/components/menu-item.d.ts +0 -3
  65. package/dist/layout/components/menu-item.js +0 -137
  66. package/dist/layout/components/menu-item.js.map +0 -1
  67. package/dist/layout/components/menu.d.ts +0 -3
  68. package/dist/layout/components/menu.js +0 -14
  69. package/dist/layout/components/menu.js.map +0 -1
  70. package/dist/layout/components/popover.d.ts +0 -17
  71. package/dist/layout/components/popover.js +0 -46
  72. package/dist/layout/components/popover.js.map +0 -1
  73. package/dist/layout/components/sidebar-footer.d.ts +0 -3
  74. package/dist/layout/components/sidebar-footer.js +0 -12
  75. package/dist/layout/components/sidebar-footer.js.map +0 -1
  76. package/dist/layout/components/sidebar.d.ts +0 -3
  77. package/dist/layout/components/sidebar.js +0 -55
  78. package/dist/layout/components/sidebar.js.map +0 -1
  79. package/dist/layout/components/topbar.d.ts +0 -3
  80. package/dist/layout/components/topbar.js +0 -16
  81. package/dist/layout/components/topbar.js.map +0 -1
  82. package/dist/toast/callout.d.ts +0 -5
  83. package/dist/toast/callout.js +0 -31
  84. package/dist/toast/callout.js.map +0 -1
  85. package/dist/toast/index.d.ts +0 -6
  86. package/dist/toast/index.js +0 -5
  87. package/dist/toast/toast.d.ts +0 -7
  88. package/dist/toast/toast.js +0 -47
  89. package/dist/toast/toast.js.map +0 -1
  90. package/dist/toast/toaster.d.ts +0 -3
  91. package/dist/toast/toaster.js +0 -63
  92. package/dist/toast/toaster.js.map +0 -1
  93. package/dist/toast/variant-styles.d.ts +0 -6
  94. package/dist/toast/variant-styles.js +0 -51
  95. package/dist/toast/variant-styles.js.map +0 -1
  96. package/dist-standalone/chunks/chart-view-BKbOL4wu.js +0 -59
  97. package/dist-standalone/chunks/dist-DAHNiLp2.js +0 -106
  98. package/dist-standalone/chunks/rich-editor-field-D1bcp0AJ.js +0 -53
  99. package/dist-standalone/chunks/runtime-D0Xtwwcq.js +0 -162
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lattice-php/lattice",
3
- "version": "0.61.0",
3
+ "version": "0.63.0",
4
4
  "description": "Server-driven React components for Laravel and Inertia.",
5
5
  "license": "MIT",
6
6
  "author": "Manuel Christlieb <manuel@christlieb.eu>",
@@ -76,10 +76,6 @@
76
76
  "types": "./dist/ssr.d.ts",
77
77
  "import": "./dist/ssr.js"
78
78
  },
79
- "./toast": {
80
- "types": "./dist/toast/index.d.ts",
81
- "import": "./dist/toast/index.js"
82
- },
83
79
  "./types": {
84
80
  "types": "./dist/types/index.d.ts"
85
81
  },
@@ -113,17 +109,16 @@
113
109
  "typecheck": "tsc --noEmit"
114
110
  },
115
111
  "dependencies": {
116
- "@lattice-php/action": "0.61.0",
117
- "@lattice-php/core": "0.61.0",
118
- "@lattice-php/form": "0.61.0",
119
- "@lattice-php/table": "0.61.0",
120
- "@lattice-php/ui": "0.61.0",
112
+ "@lattice-php/action": "0.63.0",
113
+ "@lattice-php/core": "0.63.0",
114
+ "@lattice-php/form": "0.63.0",
115
+ "@lattice-php/table": "0.63.0",
116
+ "@lattice-php/ui": "0.63.0",
121
117
  "@lattice-php/vite-svg-sprite": "^0.3.0",
122
118
  "@atlaskit/pragmatic-drag-and-drop": "^2.0.2",
123
119
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
124
120
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
125
- "@atlaskit/pragmatic-drag-and-drop-live-region": "^2.0.0",
126
- "@radix-ui/react-toast": "^1.2.23"
121
+ "@atlaskit/pragmatic-drag-and-drop-live-region": "^2.0.0"
127
122
  },
128
123
  "peerDependencies": {
129
124
  "@inertiajs/core": "^3.0.0",
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const BreadcrumbsComponent: RendererComponent<"breadcrumbs">;
3
- export default BreadcrumbsComponent;
@@ -1,41 +0,0 @@
1
- import { Link, usePage } from "@inertiajs/react";
2
- import { Fragment } from "react";
3
- import { useT } from "@lattice-php/ui/i18n";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- import { nodeIdentity } from "@lattice-php/core/test-id";
6
- //#region resources/js/layout/components/breadcrumbs.tsx
7
- var BreadcrumbsComponent = ({ node }) => {
8
- const { t } = useT("lattice");
9
- const crumbs = usePage().props.lattice?.breadcrumbs ?? [];
10
- if (crumbs.length === 0) return null;
11
- return /* @__PURE__ */ jsx("nav", {
12
- "aria-label": t("common.breadcrumb", "Breadcrumb"),
13
- className: "min-w-0 flex-1",
14
- "data-lattice-component": nodeIdentity(node),
15
- children: /* @__PURE__ */ jsx("ol", {
16
- className: "flex items-center gap-2 text-sm text-lt-muted-fg",
17
- children: crumbs.map((crumb, index) => {
18
- const isLast = index === crumbs.length - 1;
19
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("li", {
20
- className: "min-w-0",
21
- children: isLast ? /* @__PURE__ */ jsx("span", {
22
- "aria-current": "page",
23
- className: "block truncate text-lt-fg",
24
- children: crumb.title
25
- }) : /* @__PURE__ */ jsx(Link, {
26
- className: "block truncate hover:text-lt-fg",
27
- href: crumb.href,
28
- children: crumb.title
29
- })
30
- }), isLast ? null : /* @__PURE__ */ jsx("li", {
31
- "aria-hidden": "true",
32
- children: "/"
33
- })] }, crumb.href);
34
- })
35
- })
36
- });
37
- };
38
- //#endregion
39
- export { BreadcrumbsComponent as default };
40
-
41
- //# sourceMappingURL=breadcrumbs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../../resources/js/layout/components/breadcrumbs.tsx"],"sourcesContent":["import { Link, usePage } from \"@inertiajs/react\";\nimport { Fragment } from \"react\";\nimport type { RendererComponent } from \"@lattice-php/core/types\";\nimport type { PagePayload } from \"@lattice-php/lattice/types\";\nimport { nodeIdentity } from \"@lattice-php/core/test-id\";\nimport { useT } from \"@lattice-php/ui/i18n\";\n\nconst BreadcrumbsComponent: RendererComponent<\"breadcrumbs\"> = ({ node }) => {\n const { t } = useT(\"lattice\");\n const page = usePage();\n const crumbs = (page.props.lattice as PagePayload | undefined)?.breadcrumbs ?? [];\n\n if (crumbs.length === 0) {\n return null;\n }\n\n return (\n <nav\n aria-label={t(\"common.breadcrumb\", \"Breadcrumb\")}\n className=\"min-w-0 flex-1\"\n data-lattice-component={nodeIdentity(node)}\n >\n <ol className=\"flex items-center gap-2 text-sm text-lt-muted-fg\">\n {crumbs.map((crumb, index) => {\n const isLast = index === crumbs.length - 1;\n\n return (\n <Fragment key={crumb.href}>\n <li className=\"min-w-0\">\n {isLast ? (\n <span aria-current=\"page\" className=\"block truncate text-lt-fg\">\n {crumb.title}\n </span>\n ) : (\n <Link className=\"block truncate hover:text-lt-fg\" href={crumb.href}>\n {crumb.title}\n </Link>\n )}\n </li>\n {isLast ? null : <li aria-hidden=\"true\">/</li>}\n </Fragment>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nexport default BreadcrumbsComponent;\n"],"mappings":";;;;;;AAOA,IAAM,wBAA0D,EAAE,WAAW;CAC3E,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,MAAM,SADO,QACG,CAAA,CAAK,MAAM,SAAqC,eAAe,CAAC;CAEhF,IAAI,OAAO,WAAW,GACpB,OAAO;CAGT,OACE,oBAAC,OAAD;EACE,cAAY,EAAE,qBAAqB,YAAY;EAC/C,WAAU;EACV,0BAAwB,aAAa,IAAI;EAEzC,UAAA,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,OAAO,KAAK,OAAO,UAAU;IAC5B,MAAM,SAAS,UAAU,OAAO,SAAS;IAEzC,OACE,qBAAC,UAAD,EAAA,UAAA,CACE,oBAAC,MAAD;KAAI,WAAU;KACX,UAAA,SACC,oBAAC,QAAD;MAAM,gBAAa;MAAO,WAAU;MACjC,UAAA,MAAM;KACH,CAAA,IAEN,oBAAC,MAAD;MAAM,WAAU;MAAkC,MAAM,MAAM;MAC3D,UAAA,MAAM;KACH,CAAA;IAEN,CAAA,GACH,SAAS,OAAO,oBAAC,MAAD;KAAI,eAAY;KAAO,UAAA;IAAK,CAAA,CACrC,EAAA,GAbK,MAAM,IAaX;GAEd,CAAC;EACC,CAAA;CACD,CAAA;AAET"}
@@ -1,15 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- /**
3
- * Renders callouts emitted on the bus. A keyed callout is a projection of
4
- * server state: it replaces any callout sharing its key, and is dropped when
5
- * `navigate` fires. Inertia only fires `navigate` for a URL-changing visit
6
- * (initial load included); a same-URL visit — `router.reload()`,
7
- * `redirect()->back()` to the same URL, polling, partial reloads — sets
8
- * `replace` instead and never fires it, so the callout survives until the
9
- * server overwrites or drops it. On these URL-changing visits, `navigate`
10
- * fires before `flash`, so re-assertion always wins over the clear and no
11
- * ordering guard is needed. A `retract-callout` effect clears one on a
12
- * same-URL response too.
13
- */
14
- declare const Callouts: RendererComponent<"callouts">;
15
- export default Callouts;
@@ -1,89 +0,0 @@
1
- import { onCallout, onRetractCallout } from "../../toast/callout.js";
2
- import { variantStyles } from "../../toast/variant-styles.js";
3
- import { router } from "@inertiajs/react";
4
- import { useEffect, useState } from "react";
5
- import { Icon } from "@lattice-php/ui/icons";
6
- import { RenderNode } from "@lattice-php/core/renderer";
7
- import { resolveText } from "@lattice-php/ui/i18n/translatable";
8
- import { cn } from "@lattice-php/ui/lib/utils";
9
- import { useT } from "@lattice-php/ui/i18n";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- //#region resources/js/layout/components/callouts.tsx
12
- var nextId = 0;
13
- /**
14
- * Renders callouts emitted on the bus. A keyed callout is a projection of
15
- * server state: it replaces any callout sharing its key, and is dropped when
16
- * `navigate` fires. Inertia only fires `navigate` for a URL-changing visit
17
- * (initial load included); a same-URL visit — `router.reload()`,
18
- * `redirect()->back()` to the same URL, polling, partial reloads — sets
19
- * `replace` instead and never fires it, so the callout survives until the
20
- * server overwrites or drops it. On these URL-changing visits, `navigate`
21
- * fires before `flash`, so re-assertion always wins over the clear and no
22
- * ordering guard is needed. A `retract-callout` effect clears one on a
23
- * same-URL response too.
24
- */
25
- var Callouts = () => {
26
- const { t } = useT("lattice");
27
- const [callouts, setCallouts] = useState([]);
28
- useEffect(() => onCallout((callout) => {
29
- setCallouts((current) => {
30
- return [...callout.unique ? current.filter((existing) => existing.unique !== callout.unique) : current, {
31
- ...callout,
32
- id: nextId++
33
- }];
34
- });
35
- }), []);
36
- useEffect(() => router.on("navigate", () => {
37
- setCallouts((current) => current.filter((callout) => !callout.unique));
38
- }), []);
39
- useEffect(() => onRetractCallout((unique) => {
40
- setCallouts((current) => current.filter((callout) => callout.unique !== unique));
41
- }), []);
42
- function dismiss(id) {
43
- setCallouts((current) => current.filter((callout) => callout.id !== id));
44
- }
45
- if (callouts.length === 0) return null;
46
- return /* @__PURE__ */ jsx("div", {
47
- className: "flex w-full flex-col gap-2",
48
- children: callouts.map((callout) => /* @__PURE__ */ jsxs("div", {
49
- role: "status",
50
- "data-test": `callout-${callout.variant}`,
51
- className: cn("flex items-start gap-3 rounded-lt border border-l-4 border-lt-border bg-lt-popover p-4 text-lt-popover-fg", variantStyles[callout.variant].accent),
52
- children: [
53
- variantStyles[callout.variant].icon,
54
- /* @__PURE__ */ jsxs("div", {
55
- className: "flex min-w-0 flex-1 flex-col gap-2",
56
- children: [
57
- callout.title ? /* @__PURE__ */ jsx("p", {
58
- className: "text-sm font-medium text-lt-fg",
59
- children: resolveText(callout.title, t)
60
- }) : null,
61
- /* @__PURE__ */ jsx("p", {
62
- className: "text-sm text-lt-fg",
63
- children: resolveText(callout.message, t)
64
- }),
65
- callout.action ? /* @__PURE__ */ jsx("div", {
66
- className: "flex flex-wrap gap-2",
67
- children: /* @__PURE__ */ jsx(RenderNode, { node: callout.action })
68
- }) : null
69
- ]
70
- }),
71
- callout.dismissible ? /* @__PURE__ */ jsx("button", {
72
- type: "button",
73
- "aria-label": t("common.dismiss", "Dismiss"),
74
- "data-test": "callout-dismiss",
75
- className: "shrink-0 rounded-lt-sm p-1 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg",
76
- onClick: () => dismiss(callout.id),
77
- children: /* @__PURE__ */ jsx(Icon, {
78
- name: "x",
79
- className: "size-lt-icon-md"
80
- })
81
- }) : null
82
- ]
83
- }, callout.id))
84
- });
85
- };
86
- //#endregion
87
- export { Callouts as default };
88
-
89
- //# sourceMappingURL=callouts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callouts.js","names":[],"sources":["../../../resources/js/layout/components/callouts.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/ui/icons\";\nimport { router } from \"@inertiajs/react\";\nimport { useEffect, useState } from \"react\";\nimport { RenderNode } from \"@lattice-php/core/renderer\";\nimport type { RendererComponent } from \"@lattice-php/core/types\";\nimport type { Callout } from \"@lattice-php/ui\";\nimport { onCallout, onRetractCallout } from \"@lattice-php/lattice/toast\";\nimport { cn } from \"@lattice-php/ui/lib/utils\";\nimport { useT } from \"@lattice-php/ui/i18n\";\nimport { resolveText } from \"@lattice-php/ui/i18n/translatable\";\nimport { variantStyles } from \"@lattice-php/lattice/toast\";\n\ntype CalloutItem = Callout & { id: number };\n\nlet nextId = 0;\n\n/**\n * Renders callouts emitted on the bus. A keyed callout is a projection of\n * server state: it replaces any callout sharing its key, and is dropped when\n * `navigate` fires. Inertia only fires `navigate` for a URL-changing visit\n * (initial load included); a same-URL visit — `router.reload()`,\n * `redirect()->back()` to the same URL, polling, partial reloads — sets\n * `replace` instead and never fires it, so the callout survives until the\n * server overwrites or drops it. On these URL-changing visits, `navigate`\n * fires before `flash`, so re-assertion always wins over the clear and no\n * ordering guard is needed. A `retract-callout` effect clears one on a\n * same-URL response too.\n */\nconst Callouts: RendererComponent<\"callouts\"> = () => {\n const { t } = useT(\"lattice\");\n const [callouts, setCallouts] = useState<CalloutItem[]>([]);\n\n useEffect(\n () =>\n onCallout((callout) => {\n setCallouts((current) => {\n const kept = callout.unique\n ? current.filter((existing) => existing.unique !== callout.unique)\n : current;\n\n return [...kept, { ...callout, id: nextId++ }];\n });\n }),\n [],\n );\n\n useEffect(\n () =>\n router.on(\"navigate\", () => {\n setCallouts((current) => current.filter((callout) => !callout.unique));\n }),\n [],\n );\n\n useEffect(\n () =>\n onRetractCallout((unique) => {\n setCallouts((current) => current.filter((callout) => callout.unique !== unique));\n }),\n [],\n );\n\n function dismiss(id: number): void {\n setCallouts((current) => current.filter((callout) => callout.id !== id));\n }\n\n if (callouts.length === 0) {\n return null;\n }\n\n return (\n <div className=\"flex w-full flex-col gap-2\">\n {callouts.map((callout) => (\n <div\n key={callout.id}\n role=\"status\"\n data-test={`callout-${callout.variant}`}\n className={cn(\n \"flex items-start gap-3 rounded-lt border border-l-4 border-lt-border bg-lt-popover p-4 text-lt-popover-fg\",\n variantStyles[callout.variant].accent,\n )}\n >\n {variantStyles[callout.variant].icon}\n <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n {callout.title ? (\n <p className=\"text-sm font-medium text-lt-fg\">{resolveText(callout.title, t)}</p>\n ) : null}\n <p className=\"text-sm text-lt-fg\">{resolveText(callout.message, t)}</p>\n {callout.action ? (\n <div className=\"flex flex-wrap gap-2\">\n <RenderNode node={callout.action} />\n </div>\n ) : null}\n </div>\n {callout.dismissible ? (\n <button\n type=\"button\"\n aria-label={t(\"common.dismiss\", \"Dismiss\")}\n data-test=\"callout-dismiss\"\n className=\"shrink-0 rounded-lt-sm p-1 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg\"\n onClick={() => dismiss(callout.id)}\n >\n <Icon name=\"x\" className=\"size-lt-icon-md\" />\n </button>\n ) : null}\n </div>\n ))}\n </div>\n );\n};\n\nexport default Callouts;\n"],"mappings":";;;;;;;;;;;AAcA,IAAI,SAAS;;;;;;;;;;;;;AAcb,IAAM,iBAAgD;CACpD,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,CAAC,UAAU,eAAe,SAAwB,CAAC,CAAC;CAE1D,gBAEI,WAAW,YAAY;EACrB,aAAa,YAAY;GAKvB,OAAO,CAAC,GAJK,QAAQ,SACjB,QAAQ,QAAQ,aAAa,SAAS,WAAW,QAAQ,MAAM,IAC/D,SAEa;IAAE,GAAG;IAAS,IAAI;GAAS,CAAC;EAC/C,CAAC;CACH,CAAC,GACH,CAAC,CACH;CAEA,gBAEI,OAAO,GAAG,kBAAkB;EAC1B,aAAa,YAAY,QAAQ,QAAQ,YAAY,CAAC,QAAQ,MAAM,CAAC;CACvE,CAAC,GACH,CAAC,CACH;CAEA,gBAEI,kBAAkB,WAAW;EAC3B,aAAa,YAAY,QAAQ,QAAQ,YAAY,QAAQ,WAAW,MAAM,CAAC;CACjF,CAAC,GACH,CAAC,CACH;CAEA,SAAS,QAAQ,IAAkB;EACjC,aAAa,YAAY,QAAQ,QAAQ,YAAY,QAAQ,OAAO,EAAE,CAAC;CACzE;CAEA,IAAI,SAAS,WAAW,GACtB,OAAO;CAGT,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,SAAS,KAAK,YACb,qBAAC,OAAD;GAEE,MAAK;GACL,aAAW,WAAW,QAAQ;GAC9B,WAAW,GACT,6GACA,cAAc,QAAQ,QAAQ,CAAC,MACjC;GAPF,UAAA;IASG,cAAc,QAAQ,QAAQ,CAAC;IAChC,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACG,QAAQ,QACP,oBAAC,KAAD;OAAG,WAAU;OAAkC,UAAA,YAAY,QAAQ,OAAO,CAAC;MAAK,CAAA,IAC9E;MACJ,oBAAC,KAAD;OAAG,WAAU;OAAsB,UAAA,YAAY,QAAQ,SAAS,CAAC;MAAK,CAAA;MACrE,QAAQ,SACP,oBAAC,OAAD;OAAK,WAAU;OACb,UAAA,oBAAC,YAAD,EAAY,MAAM,QAAQ,OAAS,CAAA;MAChC,CAAA,IACH;KACD;;IACJ,QAAQ,cACP,oBAAC,UAAD;KACE,MAAK;KACL,cAAY,EAAE,kBAAkB,SAAS;KACzC,aAAU;KACV,WAAU;KACV,eAAe,QAAQ,QAAQ,EAAE;KAEjC,UAAA,oBAAC,MAAD;MAAM,MAAK;MAAI,WAAU;KAAmB,CAAA;IACtC,CAAA,IACN;GACD;EA/BE,GAAA,QAAQ,EA+BV,CACN;CACE,CAAA;AAET"}
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const DropdownComponent: RendererComponent<"dropdown">;
3
- export default DropdownComponent;
@@ -1,24 +0,0 @@
1
- import { Popover } from "./popover.js";
2
- import { RenderNode } from "@lattice-php/core/renderer";
3
- import { jsx } from "react/jsx-runtime";
4
- //#region resources/js/layout/components/dropdown.tsx
5
- var DropdownComponent = ({ children, node }) => {
6
- const testId = node.key ?? "dropdown";
7
- return /* @__PURE__ */ jsx(Popover, {
8
- placement: node.props.placement,
9
- testId,
10
- triggerClassName: "w-auto",
11
- trigger: /* @__PURE__ */ jsx("span", {
12
- className: "flex min-w-0 items-center rounded-lt-sm px-2 py-1.5 text-sm hover:bg-lt-muted",
13
- children: node.props.trigger.map((triggerNode, index) => /* @__PURE__ */ jsx(RenderNode, { node: triggerNode }, triggerNode.key ?? `${triggerNode.type}-${index}`))
14
- }),
15
- children: /* @__PURE__ */ jsx("ul", {
16
- className: "flex flex-col gap-1",
17
- children
18
- })
19
- });
20
- };
21
- //#endregion
22
- export { DropdownComponent as default };
23
-
24
- //# sourceMappingURL=dropdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdown.js","names":[],"sources":["../../../resources/js/layout/components/dropdown.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/core/types\";\nimport { RenderNode } from \"@lattice-php/core/renderer\";\nimport { Popover } from \"./popover\";\n\nconst DropdownComponent: RendererComponent<\"dropdown\"> = ({ children, node }) => {\n const testId = node.key ?? \"dropdown\";\n\n return (\n <Popover\n placement={node.props.placement}\n testId={testId}\n triggerClassName=\"w-auto\"\n trigger={\n <span className=\"flex min-w-0 items-center rounded-lt-sm px-2 py-1.5 text-sm hover:bg-lt-muted\">\n {node.props.trigger.map((triggerNode, index) => (\n <RenderNode\n key={triggerNode.key ?? `${triggerNode.type}-${index}`}\n node={triggerNode}\n />\n ))}\n </span>\n }\n >\n <ul className=\"flex flex-col gap-1\">{children}</ul>\n </Popover>\n );\n};\n\nexport default DropdownComponent;\n"],"mappings":";;;;AAIA,IAAM,qBAAoD,EAAE,UAAU,WAAW;CAC/E,MAAM,SAAS,KAAK,OAAO;CAE3B,OACE,oBAAC,SAAD;EACE,WAAW,KAAK,MAAM;EACd;EACR,kBAAiB;EACjB,SACE,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA,KAAK,MAAM,QAAQ,KAAK,aAAa,UACpC,oBAAC,YAAD,EAEE,MAAM,YACP,GAFM,YAAY,OAAO,GAAG,YAAY,KAAK,GAAG,OAEhD,CACF;EACG,CAAA;EAGR,UAAA,oBAAC,MAAD;GAAI,WAAU;GAAuB;EAAa,CAAA;CAC3C,CAAA;AAEb"}
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const MenuItemComponent: RendererComponent<"menu-item">;
3
- export default MenuItemComponent;
@@ -1,137 +0,0 @@
1
- import { Popover } from "./popover.js";
2
- import { Link, usePage } from "@inertiajs/react";
3
- import { useState } from "react";
4
- import { Icon, IconRenderer } from "@lattice-php/ui/icons";
5
- import { cn } from "@lattice-php/ui/lib/utils";
6
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
- import { prefixedNodeTestId } from "@lattice-php/core/test-id";
8
- import { useCollapsed } from "@lattice-php/core/collapsed-context";
9
- import { ActionTrigger, useClickBehavior } from "@lattice-php/ui/click-behavior";
10
- //#region resources/js/layout/components/menu-item.tsx
11
- var rowClass = "flex items-center gap-2 rounded-lt-sm px-3 py-2 text-base font-medium text-lt-fg transition-colors hover:bg-lt-muted";
12
- function MenuAffix({ affix, className }) {
13
- if (affix.icon) return /* @__PURE__ */ jsx(IconRenderer, {
14
- className: cn("size-lt-icon-md shrink-0", className),
15
- icon: affix.icon
16
- });
17
- return /* @__PURE__ */ jsx("span", {
18
- className: cn("shrink-0 text-sm text-lt-muted-fg", className),
19
- children: affix.text
20
- });
21
- }
22
- function schemaContainsPath(schema, path) {
23
- return (schema ?? []).some((child) => child.props?.href === path || schemaContainsPath(child.schema, path));
24
- }
25
- var MenuItemComponent = ({ children, node }) => {
26
- const collapsed = useCollapsed();
27
- const { icon, label: rawLabel, prefix, suffix } = node.props;
28
- const label = rawLabel ?? "";
29
- const iconOnly = Boolean(icon);
30
- const flyoutIcon = icon ?? prefix?.icon ?? null;
31
- const currentPath = usePage().url.split("?")[0];
32
- const testId = prefixedNodeTestId("menu", node);
33
- const behavior = useClickBehavior(node.props);
34
- const content = icon ? /* @__PURE__ */ jsx(IconRenderer, {
35
- className: "size-lt-icon-md shrink-0",
36
- icon
37
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
38
- prefix ? /* @__PURE__ */ jsx(MenuAffix, { affix: prefix }) : null,
39
- collapsed ? /* @__PURE__ */ jsx("span", {
40
- className: "pointer-events-none absolute top-1/2 left-full z-lt-popover ml-2 hidden -translate-y-1/2 rounded-lt-sm border border-lt-border bg-lt-popover px-2 py-1 text-sm whitespace-nowrap text-lt-popover-fg shadow-lt-md group-hover:block",
41
- role: "tooltip",
42
- children: label
43
- }) : /* @__PURE__ */ jsx("span", { children: label }),
44
- suffix ? /* @__PURE__ */ jsx(MenuAffix, {
45
- affix: suffix,
46
- className: "ml-auto"
47
- }) : null
48
- ] });
49
- const rowClassName = cn(rowClass, "w-full", collapsed && "group relative justify-center", iconOnly && "justify-center");
50
- const triggerButton = ({ onClick, processing }) => /* @__PURE__ */ jsx("button", {
51
- "aria-label": collapsed || iconOnly ? label : void 0,
52
- className: rowClassName,
53
- "data-test": testId,
54
- disabled: processing,
55
- onClick,
56
- type: "button",
57
- children: content
58
- });
59
- if (behavior.kind === "action") return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(ActionTrigger, {
60
- action: behavior.action,
61
- children: triggerButton
62
- }) });
63
- if (behavior.kind === "effects" || behavior.kind === "modal") return /* @__PURE__ */ jsx("li", { children: triggerButton({
64
- onClick: behavior.onClick,
65
- processing: false
66
- }) });
67
- if (behavior.kind === "navigate") {
68
- const active = currentPath === behavior.href;
69
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
70
- "aria-current": active ? "page" : void 0,
71
- "aria-label": collapsed || iconOnly ? label : void 0,
72
- as: behavior.method === "get" ? void 0 : "button",
73
- className: cn(rowClassName, active && "bg-lt-muted font-medium"),
74
- "data-test": testId,
75
- href: behavior.href,
76
- method: behavior.method,
77
- children: content
78
- }) });
79
- }
80
- if (!children) return collapsed ? null : /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", {
81
- className: "flex items-center gap-2 px-3 py-2 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase",
82
- children: content
83
- }) });
84
- if (collapsed) return /* @__PURE__ */ jsx(FlyoutGroup, {
85
- icon: flyoutIcon,
86
- label,
87
- testId,
88
- children
89
- });
90
- return /* @__PURE__ */ jsx(CollapsibleItem, {
91
- content,
92
- defaultOpen: schemaContainsPath(node.schema, currentPath),
93
- testId,
94
- children
95
- });
96
- };
97
- function CollapsibleItem({ children, content, defaultOpen, testId }) {
98
- const [open, setOpen] = useState(defaultOpen);
99
- return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsxs("button", {
100
- "aria-expanded": open,
101
- className: cn(rowClass, "w-full"),
102
- "data-test": testId,
103
- onClick: () => setOpen((value) => !value),
104
- type: "button",
105
- children: [content, /* @__PURE__ */ jsx(Icon, {
106
- name: "chevron-right",
107
- className: cn("ml-auto size-lt-icon-md shrink-0 transition-transform", open && "rotate-90")
108
- })]
109
- }), open ? /* @__PURE__ */ jsx("ul", {
110
- className: "mt-1 flex flex-col gap-1 pl-3",
111
- children
112
- }) : null] });
113
- }
114
- function FlyoutGroup({ children, icon, label, testId }) {
115
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Popover, {
116
- className: "min-w-48",
117
- placement: "right",
118
- testId,
119
- trigger: icon ? /* @__PURE__ */ jsx(IconRenderer, {
120
- className: "size-lt-icon-md shrink-0",
121
- icon
122
- }) : /* @__PURE__ */ jsx("span", { children: label }),
123
- triggerClassName: cn(rowClass, "justify-center"),
124
- triggerLabel: label,
125
- children: /* @__PURE__ */ jsxs("ul", {
126
- className: "flex flex-col gap-1",
127
- children: [/* @__PURE__ */ jsx("li", {
128
- className: "px-3 py-1.5 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase",
129
- children: label
130
- }), children]
131
- })
132
- }) });
133
- }
134
- //#endregion
135
- export { MenuItemComponent as default };
136
-
137
- //# sourceMappingURL=menu-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-item.js","names":[],"sources":["../../../resources/js/layout/components/menu-item.tsx"],"sourcesContent":["import { Link, usePage } from \"@inertiajs/react\";\nimport { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { prefixedNodeTestId } from \"@lattice-php/core/test-id\";\nimport type { RendererComponent, Schema } from \"@lattice-php/core/types\";\nimport { Icon, IconRenderer } from \"@lattice-php/ui/icons\";\nimport { cn } from \"@lattice-php/ui/lib/utils\";\nimport type { Affix } from \"@lattice-php/core\";\nimport { ActionTrigger, type TriggerState, useClickBehavior } from \"@lattice-php/ui/click-behavior\";\nimport { useCollapsed } from \"@lattice-php/core/collapsed-context\";\nimport { Popover } from \"./popover\";\n\nconst rowClass =\n \"flex items-center gap-2 rounded-lt-sm px-3 py-2 text-base font-medium text-lt-fg transition-colors hover:bg-lt-muted\";\n\nfunction MenuAffix({ affix, className }: { affix: Affix; className?: string }) {\n if (affix.icon) {\n return <IconRenderer className={cn(\"size-lt-icon-md shrink-0\", className)} icon={affix.icon} />;\n }\n\n return <span className={cn(\"shrink-0 text-sm text-lt-muted-fg\", className)}>{affix.text}</span>;\n}\n\nfunction schemaContainsPath(schema: Schema | undefined, path: string): boolean {\n return (schema ?? []).some(\n (child) => child.props?.href === path || schemaContainsPath(child.schema, path),\n );\n}\n\nconst MenuItemComponent: RendererComponent<\"menu-item\"> = ({ children, node }) => {\n const collapsed = useCollapsed();\n const { icon, label: rawLabel, prefix, suffix } = node.props;\n const label = rawLabel ?? \"\";\n const iconOnly = Boolean(icon);\n const flyoutIcon = icon ?? prefix?.icon ?? null;\n const currentPath = usePage().url.split(\"?\")[0];\n const testId = prefixedNodeTestId(\"menu\", node);\n const behavior = useClickBehavior(node.props);\n\n const content = icon ? (\n <IconRenderer className=\"size-lt-icon-md shrink-0\" icon={icon} />\n ) : (\n <>\n {prefix ? <MenuAffix affix={prefix} /> : null}\n {collapsed ? (\n <span\n className=\"pointer-events-none absolute top-1/2 left-full z-lt-popover ml-2 hidden -translate-y-1/2 rounded-lt-sm border border-lt-border bg-lt-popover px-2 py-1 text-sm whitespace-nowrap text-lt-popover-fg shadow-lt-md group-hover:block\"\n role=\"tooltip\"\n >\n {label}\n </span>\n ) : (\n <span>{label}</span>\n )}\n {suffix ? <MenuAffix affix={suffix} className=\"ml-auto\" /> : null}\n </>\n );\n\n const rowClassName = cn(\n rowClass,\n \"w-full\",\n collapsed && \"group relative justify-center\",\n iconOnly && \"justify-center\",\n );\n\n const triggerButton = ({ onClick, processing }: TriggerState) => (\n <button\n aria-label={collapsed || iconOnly ? label : undefined}\n className={rowClassName}\n data-test={testId}\n disabled={processing}\n onClick={onClick}\n type=\"button\"\n >\n {content}\n </button>\n );\n\n if (behavior.kind === \"action\") {\n return (\n <li>\n <ActionTrigger action={behavior.action}>{triggerButton}</ActionTrigger>\n </li>\n );\n }\n\n if (behavior.kind === \"effects\" || behavior.kind === \"modal\") {\n return <li>{triggerButton({ onClick: behavior.onClick, processing: false })}</li>;\n }\n\n if (behavior.kind === \"navigate\") {\n const active = currentPath === behavior.href;\n\n return (\n <li>\n <Link\n aria-current={active ? \"page\" : undefined}\n aria-label={collapsed || iconOnly ? label : undefined}\n as={behavior.method === \"get\" ? undefined : \"button\"}\n className={cn(rowClassName, active && \"bg-lt-muted font-medium\")}\n data-test={testId}\n href={behavior.href}\n method={behavior.method}\n >\n {content}\n </Link>\n </li>\n );\n }\n\n if (!children) {\n return collapsed ? null : (\n <li>\n <span className=\"flex items-center gap-2 px-3 py-2 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase\">\n {content}\n </span>\n </li>\n );\n }\n\n if (collapsed) {\n return (\n <FlyoutGroup icon={flyoutIcon} label={label} testId={testId}>\n {children}\n </FlyoutGroup>\n );\n }\n\n return (\n <CollapsibleItem\n content={content}\n defaultOpen={schemaContainsPath(node.schema, currentPath)}\n testId={testId}\n >\n {children}\n </CollapsibleItem>\n );\n};\n\nfunction CollapsibleItem({\n children,\n content,\n defaultOpen,\n testId,\n}: {\n children: ReactNode;\n content: ReactNode;\n defaultOpen: boolean;\n testId?: string;\n}) {\n const [open, setOpen] = useState(defaultOpen);\n\n return (\n <li>\n <button\n aria-expanded={open}\n className={cn(rowClass, \"w-full\")}\n data-test={testId}\n onClick={() => setOpen((value) => !value)}\n type=\"button\"\n >\n {content}\n <Icon\n name=\"chevron-right\"\n className={cn(\n \"ml-auto size-lt-icon-md shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n {open ? <ul className=\"mt-1 flex flex-col gap-1 pl-3\">{children}</ul> : null}\n </li>\n );\n}\n\nfunction FlyoutGroup({\n children,\n icon,\n label,\n testId,\n}: {\n children: ReactNode;\n icon?: string | null;\n label: string;\n testId?: string;\n}) {\n return (\n <li>\n <Popover\n className=\"min-w-48\"\n placement=\"right\"\n testId={testId}\n trigger={\n icon ? (\n <IconRenderer className=\"size-lt-icon-md shrink-0\" icon={icon} />\n ) : (\n <span>{label}</span>\n )\n }\n triggerClassName={cn(rowClass, \"justify-center\")}\n triggerLabel={label}\n >\n <ul className=\"flex flex-col gap-1\">\n <li className=\"px-3 py-1.5 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase\">\n {label}\n </li>\n {children}\n </ul>\n </Popover>\n </li>\n );\n}\n\nexport default MenuItemComponent;\n"],"mappings":"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"}
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const MenuComponent: RendererComponent<"menu">;
3
- export default MenuComponent;
@@ -1,14 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { nodeIdentity } from "@lattice-php/core/test-id";
3
- //#region resources/js/layout/components/menu.tsx
4
- var MenuComponent = ({ children, node }) => /* @__PURE__ */ jsx("nav", {
5
- "data-lattice-component": nodeIdentity(node),
6
- children: /* @__PURE__ */ jsx("ul", {
7
- className: "flex flex-col gap-1",
8
- children
9
- })
10
- });
11
- //#endregion
12
- export { MenuComponent as default };
13
-
14
- //# sourceMappingURL=menu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu.js","names":[],"sources":["../../../resources/js/layout/components/menu.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/core/types\";\nimport { nodeIdentity } from \"@lattice-php/core/test-id\";\n\nconst MenuComponent: RendererComponent<\"menu\"> = ({ children, node }) => (\n <nav data-lattice-component={nodeIdentity(node)}>\n <ul className=\"flex flex-col gap-1\">{children}</ul>\n </nav>\n);\n\nexport default MenuComponent;\n"],"mappings":";;;AAGA,IAAM,iBAA4C,EAAE,UAAU,WAC5D,oBAAC,OAAD;CAAK,0BAAwB,aAAa,IAAI;CAC5C,UAAA,oBAAC,MAAD;EAAI,WAAU;EAAuB;CAAa,CAAA;AAC/C,CAAA"}
@@ -1,17 +0,0 @@
1
- import { ReactNode } from 'react';
2
- /**
3
- * A navigation-aware popover for the sidebar: it wraps the shared popover
4
- * primitive (so positioning and dismissal stay consistent with the rest of the
5
- * app) and closes itself on every Inertia navigation. Items render expanded
6
- * regardless of the sidebar's collapsed state.
7
- */
8
- export declare function Popover({ align, children, className, placement, testId, trigger, triggerClassName, triggerLabel, }: {
9
- align?: "start" | "end";
10
- children: ReactNode;
11
- className?: string;
12
- placement?: "bottom" | "right" | "top";
13
- testId?: string;
14
- trigger: ReactNode;
15
- triggerClassName?: string;
16
- triggerLabel?: string;
17
- }): import("react").JSX.Element;
@@ -1,46 +0,0 @@
1
- import { usePage } from "@inertiajs/react";
2
- import { useEffect, useState } from "react";
3
- import { cn } from "@lattice-php/ui/lib/utils";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- import { Popover as Popover$1, PopoverContent, PopoverTrigger } from "@lattice-php/ui/components/popover/popover";
6
- import { CollapsedProvider } from "@lattice-php/core/collapsed-context";
7
- //#region resources/js/layout/components/popover.tsx
8
- /**
9
- * A navigation-aware popover for the sidebar: it wraps the shared popover
10
- * primitive (so positioning and dismissal stay consistent with the rest of the
11
- * app) and closes itself on every Inertia navigation. Items render expanded
12
- * regardless of the sidebar's collapsed state.
13
- */
14
- function Popover({ align = "start", children, className, placement = "bottom", testId, trigger, triggerClassName, triggerLabel }) {
15
- const [open, setOpen] = useState(false);
16
- const url = usePage().url;
17
- useEffect(() => setOpen(false), [url]);
18
- return /* @__PURE__ */ jsxs(Popover$1, {
19
- open,
20
- onOpenChange: setOpen,
21
- children: [/* @__PURE__ */ jsx(PopoverTrigger, {
22
- asChild: true,
23
- children: /* @__PURE__ */ jsx("button", {
24
- "aria-label": triggerLabel,
25
- className: cn("w-full", triggerClassName),
26
- "data-test": testId,
27
- title: triggerLabel,
28
- type: "button",
29
- children: trigger
30
- })
31
- }), /* @__PURE__ */ jsx(PopoverContent, {
32
- align,
33
- className: cn("min-w-56 p-1", className),
34
- role: "menu",
35
- side: placement,
36
- children: /* @__PURE__ */ jsx(CollapsedProvider, {
37
- collapsed: false,
38
- children
39
- })
40
- })]
41
- });
42
- }
43
- //#endregion
44
- export { Popover };
45
-
46
- //# sourceMappingURL=popover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"popover.js","names":[],"sources":["../../../resources/js/layout/components/popover.tsx"],"sourcesContent":["import { usePage } from \"@inertiajs/react\";\nimport { useEffect, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport {\n Popover as PopoverRoot,\n PopoverContent,\n PopoverTrigger,\n} from \"@lattice-php/ui/components/popover/popover\";\nimport { cn } from \"@lattice-php/ui/lib/utils\";\nimport { CollapsedProvider } from \"@lattice-php/core/collapsed-context\";\n\n/**\n * A navigation-aware popover for the sidebar: it wraps the shared popover\n * primitive (so positioning and dismissal stay consistent with the rest of the\n * app) and closes itself on every Inertia navigation. Items render expanded\n * regardless of the sidebar's collapsed state.\n */\nexport function Popover({\n align = \"start\",\n children,\n className,\n placement = \"bottom\",\n testId,\n trigger,\n triggerClassName,\n triggerLabel,\n}: {\n align?: \"start\" | \"end\";\n children: ReactNode;\n className?: string;\n placement?: \"bottom\" | \"right\" | \"top\";\n testId?: string;\n trigger: ReactNode;\n triggerClassName?: string;\n triggerLabel?: string;\n}) {\n const [open, setOpen] = useState(false);\n const url = usePage().url;\n\n useEffect(() => setOpen(false), [url]);\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n aria-label={triggerLabel}\n className={cn(\"w-full\", triggerClassName)}\n data-test={testId}\n title={triggerLabel}\n type=\"button\"\n >\n {trigger}\n </button>\n </PopoverTrigger>\n <PopoverContent\n align={align}\n className={cn(\"min-w-56 p-1\", className)}\n role=\"menu\"\n side={placement}\n >\n <CollapsedProvider collapsed={false}>{children}</CollapsedProvider>\n </PopoverContent>\n </PopoverRoot>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,QAAQ,EACtB,QAAQ,SACR,UACA,WACA,YAAY,UACZ,QACA,SACA,kBACA,gBAUC;CACD,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,MAAM,QAAQ,CAAC,CAAC;CAEtB,gBAAgB,QAAQ,KAAK,GAAG,CAAC,GAAG,CAAC;CAErC,OACE,qBAAC,WAAD;EAAmB;EAAM,cAAc;EAAvC,UAAA,CACE,oBAAC,gBAAD;GAAgB,SAAA;GACd,UAAA,oBAAC,UAAD;IACE,cAAY;IACZ,WAAW,GAAG,UAAU,gBAAgB;IACxC,aAAW;IACX,OAAO;IACP,MAAK;IAEJ,UAAA;GACK,CAAA;EACM,CAAA,GAChB,oBAAC,gBAAD;GACS;GACP,WAAW,GAAG,gBAAgB,SAAS;GACvC,MAAK;GACL,MAAM;GAEN,UAAA,oBAAC,mBAAD;IAAmB,WAAW;IAAQ;GAA4B,CAAA;EACpD,CAAA,CACL;;AAEjB"}
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const SidebarFooterComponent: RendererComponent<"sidebar.footer">;
3
- export default SidebarFooterComponent;
@@ -1,12 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { nodeIdentity } from "@lattice-php/core/test-id";
3
- //#region resources/js/layout/components/sidebar-footer.tsx
4
- var SidebarFooterComponent = ({ children, node }) => /* @__PURE__ */ jsx("div", {
5
- className: "mt-auto flex flex-col gap-4",
6
- "data-lattice-component": nodeIdentity(node),
7
- children
8
- });
9
- //#endregion
10
- export { SidebarFooterComponent as default };
11
-
12
- //# sourceMappingURL=sidebar-footer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sidebar-footer.js","names":[],"sources":["../../../resources/js/layout/components/sidebar-footer.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/core/types\";\nimport { nodeIdentity } from \"@lattice-php/core/test-id\";\n\nconst SidebarFooterComponent: RendererComponent<\"sidebar.footer\"> = ({ children, node }) => (\n <div className=\"mt-auto flex flex-col gap-4\" data-lattice-component={nodeIdentity(node)}>\n {children}\n </div>\n);\n\nexport default SidebarFooterComponent;\n"],"mappings":";;;AAGA,IAAM,0BAA+D,EAAE,UAAU,WAC/E,oBAAC,OAAD;CAAK,WAAU;CAA8B,0BAAwB,aAAa,IAAI;CACnF;AACE,CAAA"}
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const SidebarComponent: RendererComponent<"sidebar">;
3
- export default SidebarComponent;
@@ -1,55 +0,0 @@
1
- import { router } from "@inertiajs/react";
2
- import { useEffect, useState } from "react";
3
- import { LATTICE_EVENT } from "@lattice-php/core/event-names";
4
- import { cn } from "@lattice-php/ui/lib/utils";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- import { nodeIdentity } from "@lattice-php/core/test-id";
7
- import { CollapsedProvider } from "@lattice-php/core/collapsed-context";
8
- import { useWindowEvent } from "@lattice-php/core/hooks/use-window-event";
9
- import { useMediaQuery } from "@lattice-php/ui/lib/use-media-query";
10
- import { useCollapsibleState } from "@lattice-php/ui/lib/use-collapsible-state";
11
- //#region resources/js/layout/components/sidebar.tsx
12
- var DESKTOP_QUERY = "(min-width: 768px)";
13
- function matchesTarget(event, identity) {
14
- const target = event.detail?.target;
15
- return target == null || target === identity;
16
- }
17
- var SidebarComponent = ({ children, node }) => {
18
- const collapsible = node.props.collapsible;
19
- const rememberState = node.props.rememberState;
20
- const identity = nodeIdentity(node);
21
- const storageKey = `lattice:sidebar:${identity ?? "default"}`;
22
- const isDesktop = useMediaQuery(DESKTOP_QUERY, true);
23
- const [collapsed, toggleCollapsed] = useCollapsibleState(storageKey, false, collapsible && rememberState);
24
- const [mobileOpen, setMobileOpen] = useState(false);
25
- useWindowEvent(LATTICE_EVENT.toggleSidebar, (event) => {
26
- if (!matchesTarget(event, identity)) return;
27
- if (window.matchMedia?.(DESKTOP_QUERY).matches ?? true) {
28
- if (collapsible) toggleCollapsed();
29
- } else setMobileOpen((open) => !open);
30
- });
31
- useEffect(() => router.on("navigate", () => setMobileOpen(false)), []);
32
- useWindowEvent("keydown", (event) => {
33
- if (event.key === "Escape") setMobileOpen(false);
34
- }, { enabled: mobileOpen });
35
- const isCollapsed = collapsible && collapsed && isDesktop;
36
- return /* @__PURE__ */ jsxs(CollapsedProvider, {
37
- collapsed: isCollapsed,
38
- children: [mobileOpen ? /* @__PURE__ */ jsx("div", {
39
- "aria-hidden": "true",
40
- className: "fixed inset-0 z-lt-overlay bg-lt-overlay md:hidden",
41
- "data-test": "sidebar-backdrop",
42
- onClick: () => setMobileOpen(false)
43
- }) : null, /* @__PURE__ */ jsx("aside", {
44
- className: cn("fixed inset-y-0 left-0 z-lt-modal flex h-svh w-72 max-w-[80vw] shrink-0 flex-col gap-4 border-r border-lt-border bg-lt-bg p-4 transition-transform", "md:sticky md:top-0 md:z-auto md:max-w-none md:translate-x-0 md:transition-[width]", mobileOpen ? "translate-x-0" : "-translate-x-full", isCollapsed ? "md:w-16 md:overflow-visible" : "md:w-64 md:overflow-x-hidden md:overflow-y-auto"),
45
- "data-collapsed": isCollapsed ? "true" : "false",
46
- "data-lattice-component": identity,
47
- "data-test": "sidebar",
48
- children
49
- })]
50
- });
51
- };
52
- //#endregion
53
- export { SidebarComponent as default };
54
-
55
- //# sourceMappingURL=sidebar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sidebar.js","names":[],"sources":["../../../resources/js/layout/components/sidebar.tsx"],"sourcesContent":["import { router } from \"@inertiajs/react\";\nimport { useEffect, useState } from \"react\";\nimport type { RendererComponent } from \"@lattice-php/core/types\";\nimport { CollapsedProvider } from \"@lattice-php/core/collapsed-context\";\nimport { LATTICE_EVENT } from \"@lattice-php/core/event-names\";\nimport { useWindowEvent } from \"@lattice-php/core/hooks/use-window-event\";\nimport { nodeIdentity } from \"@lattice-php/core/test-id\";\nimport { cn } from \"@lattice-php/ui/lib/utils\";\nimport { useMediaQuery } from \"@lattice-php/ui/lib/use-media-query\";\nimport { useCollapsibleState } from \"@lattice-php/ui/lib/use-collapsible-state\";\n\nconst DESKTOP_QUERY = \"(min-width: 768px)\";\n\nfunction matchesTarget(event: Event, identity: string | undefined): boolean {\n const target = (event as CustomEvent<{ target?: string }>).detail?.target;\n\n return target == null || target === identity;\n}\n\nconst SidebarComponent: RendererComponent<\"sidebar\"> = ({ children, node }) => {\n const collapsible = node.props.collapsible;\n const rememberState = node.props.rememberState;\n const identity = nodeIdentity(node);\n const storageKey = `lattice:sidebar:${identity ?? \"default\"}`;\n const isDesktop = useMediaQuery(DESKTOP_QUERY, true);\n\n const [collapsed, toggleCollapsed] = useCollapsibleState(\n storageKey,\n false,\n collapsible && rememberState,\n );\n const [mobileOpen, setMobileOpen] = useState(false);\n\n useWindowEvent(LATTICE_EVENT.toggleSidebar, (event) => {\n if (!matchesTarget(event, identity)) {\n return;\n }\n\n if (window.matchMedia?.(DESKTOP_QUERY).matches ?? true) {\n if (collapsible) {\n toggleCollapsed();\n }\n } else {\n setMobileOpen((open) => !open);\n }\n });\n\n useEffect(() => router.on(\"navigate\", () => setMobileOpen(false)), []);\n\n useWindowEvent(\n \"keydown\",\n (event) => {\n if ((event as KeyboardEvent).key === \"Escape\") {\n setMobileOpen(false);\n }\n },\n { enabled: mobileOpen },\n );\n\n const isCollapsed = collapsible && collapsed && isDesktop;\n\n return (\n <CollapsedProvider collapsed={isCollapsed}>\n {mobileOpen ? (\n <div\n aria-hidden=\"true\"\n className=\"fixed inset-0 z-lt-overlay bg-lt-overlay md:hidden\"\n data-test=\"sidebar-backdrop\"\n onClick={() => setMobileOpen(false)}\n />\n ) : null}\n <aside\n className={cn(\n \"fixed inset-y-0 left-0 z-lt-modal flex h-svh w-72 max-w-[80vw] shrink-0 flex-col gap-4 border-r border-lt-border bg-lt-bg p-4 transition-transform\",\n \"md:sticky md:top-0 md:z-auto md:max-w-none md:translate-x-0 md:transition-[width]\",\n mobileOpen ? \"translate-x-0\" : \"-translate-x-full\",\n isCollapsed\n ? \"md:w-16 md:overflow-visible\"\n : \"md:w-64 md:overflow-x-hidden md:overflow-y-auto\",\n )}\n data-collapsed={isCollapsed ? \"true\" : \"false\"}\n data-lattice-component={identity}\n data-test=\"sidebar\"\n >\n {children}\n </aside>\n </CollapsedProvider>\n );\n};\n\nexport default SidebarComponent;\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,gBAAgB;AAEtB,SAAS,cAAc,OAAc,UAAuC;CAC1E,MAAM,SAAU,MAA2C,QAAQ;CAEnE,OAAO,UAAU,QAAQ,WAAW;AACtC;AAEA,IAAM,oBAAkD,EAAE,UAAU,WAAW;CAC7E,MAAM,cAAc,KAAK,MAAM;CAC/B,MAAM,gBAAgB,KAAK,MAAM;CACjC,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,aAAa,mBAAmB,YAAY;CAClD,MAAM,YAAY,cAAc,eAAe,IAAI;CAEnD,MAAM,CAAC,WAAW,mBAAmB,oBACnC,YACA,OACA,eAAe,aACjB;CACA,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAElD,eAAe,cAAc,gBAAgB,UAAU;EACrD,IAAI,CAAC,cAAc,OAAO,QAAQ,GAChC;EAGF,IAAI,OAAO,aAAa,aAAa,CAAC,CAAC,WAAW,MAC5C;OAAA,aACF,gBAAgB;EAAA,OAGlB,eAAe,SAAS,CAAC,IAAI;CAEjC,CAAC;CAED,gBAAgB,OAAO,GAAG,kBAAkB,cAAc,KAAK,CAAC,GAAG,CAAC,CAAC;CAErE,eACE,YACC,UAAU;EACT,IAAK,MAAwB,QAAQ,UACnC,cAAc,KAAK;CAEvB,GACA,EAAE,SAAS,WAAW,CACxB;CAEA,MAAM,cAAc,eAAe,aAAa;CAEhD,OACE,qBAAC,mBAAD;EAAmB,WAAW;EAA9B,UAAA,CACG,aACC,oBAAC,OAAD;GACE,eAAY;GACZ,WAAU;GACV,aAAU;GACV,eAAe,cAAc,KAAK;EACnC,CAAA,IACC,MACJ,oBAAC,SAAD;GACE,WAAW,GACT,sJACA,qFACA,aAAa,kBAAkB,qBAC/B,cACI,gCACA,iDACN;GACA,kBAAgB,cAAc,SAAS;GACvC,0BAAwB;GACxB,aAAU;GAET;EACI,CAAA,CACU;;AAEvB"}
@@ -1,3 +0,0 @@
1
- import { RendererComponent } from '@lattice-php/core/types';
2
- declare const TopbarComponent: RendererComponent<"topbar">;
3
- export default TopbarComponent;