@lattice-php/lattice 0.30.0 → 0.31.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 (311) hide show
  1. package/dist/action/components/action-form.js +26 -25
  2. package/dist/action/components/action-form.js.map +1 -1
  3. package/dist/action/components/action-group.js.map +1 -1
  4. package/dist/action/components/action-trigger-provider.js.map +1 -1
  5. package/dist/action/components/action.js.map +1 -1
  6. package/dist/action/lib/run-action.js +2 -1
  7. package/dist/action/lib/run-action.js.map +1 -1
  8. package/dist/appearance/index.js.map +1 -1
  9. package/dist/chat/components/chat-box.js +4 -2
  10. package/dist/chat/components/chat-box.js.map +1 -1
  11. package/dist/chat/components/message-list.js.map +1 -1
  12. package/dist/chat/components/message.js.map +1 -1
  13. package/dist/chat/components/prompt-input.js.map +1 -1
  14. package/dist/chat/hooks/use-chat.js +2 -1
  15. package/dist/chat/hooks/use-chat.js.map +1 -1
  16. package/dist/chat/lib/transport.js.map +1 -1
  17. package/dist/chat/parts/text.js.map +1 -1
  18. package/dist/chat/parts/tool-call.js.map +1 -1
  19. package/dist/core/api.js.map +1 -1
  20. package/dist/core/event-names.d.ts +1 -0
  21. package/dist/core/event-names.js +1 -0
  22. package/dist/core/event-names.js.map +1 -1
  23. package/dist/core/hooks/column-sizing.js.map +1 -1
  24. package/dist/core/hooks/use-column-resizing.js.map +1 -1
  25. package/dist/core/materialize.js.map +1 -1
  26. package/dist/core/registry-context.js.map +1 -1
  27. package/dist/core/renderer.js +2 -1
  28. package/dist/core/renderer.js.map +1 -1
  29. package/dist/core/test-id.js.map +1 -1
  30. package/dist/core/upload.js.map +1 -1
  31. package/dist/create-app.js +1 -1
  32. package/dist/create-app.js.map +1 -1
  33. package/dist/effects/registry.js +2 -1
  34. package/dist/effects/registry.js.map +1 -1
  35. package/dist/form/components/base/field.js.map +1 -1
  36. package/dist/form/components/base/submit-button.js.map +1 -1
  37. package/dist/form/components/fields/add-row-menu.js.map +1 -1
  38. package/dist/form/components/fields/builder.js +2 -1
  39. package/dist/form/components/fields/builder.js.map +1 -1
  40. package/dist/form/components/fields/checkbox.js.map +1 -1
  41. package/dist/form/components/fields/choice.js.map +1 -1
  42. package/dist/form/components/fields/color-picker-field.js.map +1 -1
  43. package/dist/form/components/fields/date-input.js.map +1 -1
  44. package/dist/form/components/fields/date-picker-field.js.map +1 -1
  45. package/dist/form/components/fields/date-picker-value.js.map +1 -1
  46. package/dist/form/components/fields/date-picker.js.map +1 -1
  47. package/dist/form/components/fields/date-time-input.js.map +1 -1
  48. package/dist/form/components/fields/file-upload.js +3 -2
  49. package/dist/form/components/fields/file-upload.js.map +1 -1
  50. package/dist/form/components/fields/number-input.js.map +1 -1
  51. package/dist/form/components/fields/otp-input.js.map +1 -1
  52. package/dist/form/components/fields/password-input.js.map +1 -1
  53. package/dist/form/components/fields/repeater.js +2 -1
  54. package/dist/form/components/fields/repeater.js.map +1 -1
  55. package/dist/form/components/fields/rich-editor-field.js +6 -5
  56. package/dist/form/components/fields/rich-editor-field.js.map +1 -1
  57. package/dist/form/components/fields/rich-editor.js.map +1 -1
  58. package/dist/form/components/fields/row-action-menu.js.map +1 -1
  59. package/dist/form/components/fields/row-actions.js.map +1 -1
  60. package/dist/form/components/fields/row-item.js.map +1 -1
  61. package/dist/form/components/fields/row-templates.js.map +1 -1
  62. package/dist/form/components/fields/select.js.map +1 -1
  63. package/dist/form/components/fields/simple-field.js.map +1 -1
  64. package/dist/form/components/fields/table-rows.js.map +1 -1
  65. package/dist/form/components/fields/text-input.js.map +1 -1
  66. package/dist/form/components/fields/textarea.js.map +1 -1
  67. package/dist/form/components/fields/time-input.js.map +1 -1
  68. package/dist/form/components/fields/time-picker-columns.js.map +1 -1
  69. package/dist/form/components/fields/time-picker.js +0 -1
  70. package/dist/form/components/fields/time-picker.js.map +1 -1
  71. package/dist/form/components/fields/toggle.js.map +1 -1
  72. package/dist/form/components/fields/use-flip-reorder.js.map +1 -1
  73. package/dist/form/components/form.js +7 -5
  74. package/dist/form/components/form.js.map +1 -1
  75. package/dist/form/components/wizard.js +1 -1
  76. package/dist/form/components/wizard.js.map +1 -1
  77. package/dist/form/hooks/resolved-nodes.js.map +1 -1
  78. package/dist/form/hooks/use-dependent-field.js +2 -1
  79. package/dist/form/hooks/use-dependent-field.js.map +1 -1
  80. package/dist/form/hooks/use-form-resolver.js +2 -1
  81. package/dist/form/hooks/use-form-resolver.js.map +1 -1
  82. package/dist/form/hooks/values.js +2 -1
  83. package/dist/form/hooks/values.js.map +1 -1
  84. package/dist/form/lib/conditions.js +1 -1
  85. package/dist/form/lib/conditions.js.map +1 -1
  86. package/dist/form/lib/field-dom-name.js.map +1 -1
  87. package/dist/form/lib/field-props.js +1 -1
  88. package/dist/form/lib/field-props.js.map +1 -1
  89. package/dist/form/lib/form-path.js.map +1 -1
  90. package/dist/form/lib/form-transport.js.map +1 -1
  91. package/dist/form/lib/prefill-targets.js.map +1 -1
  92. package/dist/form/lib/wizard-steps.js.map +1 -1
  93. package/dist/form/rich-editor/builtins.js.map +1 -1
  94. package/dist/format/date-time.d.ts +1 -0
  95. package/dist/format/date-time.js +5 -1
  96. package/dist/format/date-time.js.map +1 -1
  97. package/dist/format/number.js.map +1 -1
  98. package/dist/i18n/config.js.map +1 -1
  99. package/dist/i18n/date-time-formatter.d.ts +13 -0
  100. package/dist/i18n/date-time-formatter.js +28 -0
  101. package/dist/i18n/date-time-formatter.js.map +1 -0
  102. package/dist/i18n/date-time.js +1 -1
  103. package/dist/i18n/date-time.js.map +1 -1
  104. package/dist/i18n/index.js +1 -1
  105. package/dist/i18n/instance.js +2 -0
  106. package/dist/i18n/instance.js.map +1 -1
  107. package/dist/i18n/locale.js +1 -1
  108. package/dist/i18n/locale.js.map +1 -1
  109. package/dist/i18n/timezone.js.map +1 -1
  110. package/dist/i18n/translatable.js.map +1 -1
  111. package/dist/icons/icon-renderer.js.map +1 -1
  112. package/dist/icons/sprite.js.map +1 -1
  113. package/dist/layout/components/breadcrumbs.js.map +1 -1
  114. package/dist/layout/components/callouts.d.ts +2 -1
  115. package/dist/layout/components/callouts.js +6 -2
  116. package/dist/layout/components/callouts.js.map +1 -1
  117. package/dist/layout/components/dropdown.js.map +1 -1
  118. package/dist/layout/components/menu-item.js.map +1 -1
  119. package/dist/layout/components/menu.js.map +1 -1
  120. package/dist/layout/components/popover.js.map +1 -1
  121. package/dist/layout/components/schema-layout.js.map +1 -1
  122. package/dist/layout/components/sidebar.js.map +1 -1
  123. package/dist/lib/color.js +1 -1
  124. package/dist/lib/color.js.map +1 -1
  125. package/dist/lib/use-media-query.js.map +1 -1
  126. package/dist/notifications/components/empty-state.js.map +1 -1
  127. package/dist/notifications/components/notification-item.js.map +1 -1
  128. package/dist/notifications/components/notification-list.js.map +1 -1
  129. package/dist/notifications/components/notifications.js.map +1 -1
  130. package/dist/notifications/store.js.map +1 -1
  131. package/dist/page.js.map +1 -1
  132. package/dist/provider-base.js.map +1 -1
  133. package/dist/realtime/listeners.js.map +1 -1
  134. package/dist/remote/components/data-list.js.map +1 -1
  135. package/dist/table/components/bulk-bar.js.map +1 -1
  136. package/dist/table/components/cells/badge-cell.js.map +1 -1
  137. package/dist/table/components/cells/boolean-cell.js.map +1 -1
  138. package/dist/table/components/cells/icon-cell.js.map +1 -1
  139. package/dist/table/components/cells/numeric-cell.js.map +1 -1
  140. package/dist/table/components/cells/stack-cell.js.map +1 -1
  141. package/dist/table/components/cells/text-cell.js.map +1 -1
  142. package/dist/table/components/column-filter-control.js.map +1 -1
  143. package/dist/table/components/column-header.js.map +1 -1
  144. package/dist/table/components/column-visibility-menu.js +2 -1
  145. package/dist/table/components/column-visibility-menu.js.map +1 -1
  146. package/dist/table/components/filter-bar.js +2 -1
  147. package/dist/table/components/filter-bar.js.map +1 -1
  148. package/dist/table/components/filter-controls.js +6 -5
  149. package/dist/table/components/filter-controls.js.map +1 -1
  150. package/dist/table/components/filter-value-input.js.map +1 -1
  151. package/dist/table/components/pagination.d.ts +5 -1
  152. package/dist/table/components/pagination.js +25 -6
  153. package/dist/table/components/pagination.js.map +1 -1
  154. package/dist/table/components/sort-bar.js.map +1 -1
  155. package/dist/table/components/table-cell.js +2 -1
  156. package/dist/table/components/table-cell.js.map +1 -1
  157. package/dist/table/components/table-search.js.map +1 -1
  158. package/dist/table/components/table.js +6 -2
  159. package/dist/table/components/table.js.map +1 -1
  160. package/dist/table/hooks/use-column-visibility.js.map +1 -1
  161. package/dist/table/hooks/use-table-selection.js +2 -1
  162. package/dist/table/hooks/use-table-selection.js.map +1 -1
  163. package/dist/table/hooks/use-table.d.ts +2 -0
  164. package/dist/table/hooks/use-table.js +12 -0
  165. package/dist/table/hooks/use-table.js.map +1 -1
  166. package/dist/table/lib/bulk.js.map +1 -1
  167. package/dist/table/lib/filter-values.js.map +1 -1
  168. package/dist/table/lib/format.js.map +1 -1
  169. package/dist/table/lib/payload.d.ts +2 -0
  170. package/dist/table/lib/payload.js +18 -3
  171. package/dist/table/lib/payload.js.map +1 -1
  172. package/dist/table/lib/query.js +2 -1
  173. package/dist/table/lib/query.js.map +1 -1
  174. package/dist/toast/callout.d.ts +1 -0
  175. package/dist/toast/callout.js +9 -1
  176. package/dist/toast/callout.js.map +1 -1
  177. package/dist/toast/index.d.ts +1 -1
  178. package/dist/toast/index.js +2 -2
  179. package/dist/toast/toaster.js.map +1 -1
  180. package/dist/types/generated.d.ts +9 -1
  181. package/dist/ui/affix-group.js.map +1 -1
  182. package/dist/ui/avatar.js.map +1 -1
  183. package/dist/ui/badge.js.map +1 -1
  184. package/dist/ui/button.js.map +1 -1
  185. package/dist/ui/card.js.map +1 -1
  186. package/dist/ui/chart-view.js.map +1 -1
  187. package/dist/ui/chart.js.map +1 -1
  188. package/dist/ui/checkbox.js.map +1 -1
  189. package/dist/ui/collapsible.js.map +1 -1
  190. package/dist/ui/color-picker.js.map +1 -1
  191. package/dist/ui/combobox.js.map +1 -1
  192. package/dist/ui/confirm-dialog.js.map +1 -1
  193. package/dist/ui/copyable-text.js.map +1 -1
  194. package/dist/ui/dialog.js.map +1 -1
  195. package/dist/ui/dropdown-menu.js.map +1 -1
  196. package/dist/ui/floating-panel.js.map +1 -1
  197. package/dist/ui/fragment.js +2 -1
  198. package/dist/ui/fragment.js.map +1 -1
  199. package/dist/ui/heading.js.map +1 -1
  200. package/dist/ui/icon-button.js.map +1 -1
  201. package/dist/ui/icon.js.map +1 -1
  202. package/dist/ui/image-preview.js.map +1 -1
  203. package/dist/ui/info-tooltip.js.map +1 -1
  204. package/dist/ui/input-error.js.map +1 -1
  205. package/dist/ui/input-otp.js.map +1 -1
  206. package/dist/ui/link.js.map +1 -1
  207. package/dist/ui/modal.js.map +1 -1
  208. package/dist/ui/password-input.js.map +1 -1
  209. package/dist/ui/progress.js.map +1 -1
  210. package/dist/ui/section.js +4 -2
  211. package/dist/ui/section.js.map +1 -1
  212. package/dist/ui/segmented-control.js.map +1 -1
  213. package/dist/ui/segmented-pills.js.map +1 -1
  214. package/dist/ui/tabs.js.map +1 -1
  215. package/dist/ui/text.js.map +1 -1
  216. package/dist/ui/tooltip.js.map +1 -1
  217. package/dist/vite-typescript-refresh.js.map +1 -1
  218. package/dist/vite.js.map +1 -1
  219. package/dist-standalone/chunks/chart-view-ZCTbih8A.js +59 -0
  220. package/dist-standalone/chunks/date-picker-field-CCnkf4SC.js +1 -0
  221. package/dist-standalone/chunks/dist-CK9gk4iB.js +1 -0
  222. package/dist-standalone/chunks/dist-DqlcM-vw.js +2 -0
  223. package/dist-standalone/chunks/icon-button-DcP25cn4.js +41 -0
  224. package/dist-standalone/chunks/instance-t58Awajh.js +1 -0
  225. package/dist-standalone/chunks/jsx-runtime-CN5ucv1d.js +1 -0
  226. package/dist-standalone/chunks/locale-CgtcxthU.js +1 -0
  227. package/dist-standalone/chunks/materialize-CWqnSEHR.js +1 -0
  228. package/dist-standalone/chunks/{notifications-echo-DsfNc4Ge.js → notifications-echo-uU87iJAV.js} +1 -1
  229. package/dist-standalone/chunks/number-BvVKQqOG.js +1 -0
  230. package/dist-standalone/chunks/page-props-B4GewgLI.js +1 -0
  231. package/dist-standalone/chunks/react-SIfiwpqq.js +1 -0
  232. package/dist-standalone/chunks/rich-editor-field-BtbU5XFS.js +158 -0
  233. package/dist-standalone/chunks/shared-props-B_wT1GcG.js +1 -0
  234. package/dist-standalone/chunks/subscriptions-BdHDnVA3.js +1 -0
  235. package/dist-standalone/chunks/time-picker-DSs9fDWe.js +1 -0
  236. package/dist-standalone/chunks/timezone-BukvzD0d.js +1 -0
  237. package/dist-standalone/chunks/translatable-DLw4h3x8.js +1 -0
  238. package/dist-standalone/chunks/use-effect-dispatcher-CiWYRvsF.js +97 -0
  239. package/dist-standalone/chunks/{with-selector-BwDoCrJJ.js → with-selector-zFUY-tQj.js} +1 -1
  240. package/dist-standalone/lattice.css +2 -2
  241. package/dist-standalone/lattice.js +4 -48
  242. package/dist-standalone/manifest.json +24 -15
  243. package/dist-standalone/sprite.svg +1 -1
  244. package/package.json +6 -6
  245. package/resources/icons/align-center.svg +1 -1
  246. package/resources/icons/align-justify.svg +1 -1
  247. package/resources/icons/align-left.svg +1 -1
  248. package/resources/icons/align-right.svg +1 -1
  249. package/resources/icons/arrow-down.svg +1 -1
  250. package/resources/icons/arrow-up.svg +1 -1
  251. package/resources/icons/bell.svg +1 -1
  252. package/resources/icons/bold.svg +1 -1
  253. package/resources/icons/calendar.svg +5 -5
  254. package/resources/icons/check.svg +1 -1
  255. package/resources/icons/chevron-down.svg +1 -1
  256. package/resources/icons/chevron-left.svg +1 -1
  257. package/resources/icons/chevron-right.svg +1 -1
  258. package/resources/icons/chevrons-up-down.svg +1 -1
  259. package/resources/icons/circle-alert.svg +1 -1
  260. package/resources/icons/circle-check.svg +1 -1
  261. package/resources/icons/circle-help.svg +1 -1
  262. package/resources/icons/circle-x.svg +1 -1
  263. package/resources/icons/clock.svg +1 -1
  264. package/resources/icons/code-xml.svg +1 -1
  265. package/resources/icons/code.svg +1 -1
  266. package/resources/icons/columns-3.svg +1 -1
  267. package/resources/icons/copy.svg +1 -1
  268. package/resources/icons/external-link.svg +1 -1
  269. package/resources/icons/eye-off.svg +1 -1
  270. package/resources/icons/eye.svg +1 -1
  271. package/resources/icons/filter.svg +1 -1
  272. package/resources/icons/heading-1.svg +1 -1
  273. package/resources/icons/heading-2.svg +1 -1
  274. package/resources/icons/heading-3.svg +1 -1
  275. package/resources/icons/heading.svg +1 -1
  276. package/resources/icons/highlighter.svg +1 -1
  277. package/resources/icons/info.svg +1 -1
  278. package/resources/icons/italic.svg +1 -1
  279. package/resources/icons/layout-dashboard.svg +1 -1
  280. package/resources/icons/link.svg +1 -1
  281. package/resources/icons/list-ordered.svg +1 -1
  282. package/resources/icons/list.svg +1 -1
  283. package/resources/icons/loader-2.svg +1 -1
  284. package/resources/icons/minus.svg +1 -1
  285. package/resources/icons/more-horizontal.svg +1 -1
  286. package/resources/icons/panel-left.svg +1 -1
  287. package/resources/icons/pencil-line.svg +1 -1
  288. package/resources/icons/pencil.svg +1 -1
  289. package/resources/icons/plus.svg +1 -1
  290. package/resources/icons/quote.svg +1 -1
  291. package/resources/icons/rotate-ccw.svg +1 -1
  292. package/resources/icons/rows-3.svg +1 -1
  293. package/resources/icons/search.svg +1 -1
  294. package/resources/icons/send.svg +1 -1
  295. package/resources/icons/settings.svg +1 -1
  296. package/resources/icons/smile.svg +1 -1
  297. package/resources/icons/strikethrough.svg +1 -1
  298. package/resources/icons/table.svg +1 -1
  299. package/resources/icons/trash-2.svg +1 -1
  300. package/resources/icons/underline.svg +1 -1
  301. package/resources/icons/x.svg +1 -1
  302. package/dist-standalone/chunks/chart-view-CpYsLvzR.js +0 -36
  303. package/dist-standalone/chunks/date-picker-field-lX8N40Ii.js +0 -1
  304. package/dist-standalone/chunks/dist-PaT1gYi_.js +0 -2
  305. package/dist-standalone/chunks/jsx-runtime-Drll_-DD.js +0 -1
  306. package/dist-standalone/chunks/locale-CXqr7LPR.js +0 -1
  307. package/dist-standalone/chunks/page-props-ClpVjpOc.js +0 -1
  308. package/dist-standalone/chunks/react-B8IZ02wI.js +0 -1
  309. package/dist-standalone/chunks/rich-editor-field-C71csVJv.js +0 -154
  310. package/dist-standalone/chunks/subscriptions-B1STcwPE.js +0 -1
  311. package/dist-standalone/chunks/use-effect-dispatcher-I8So0l_I.js +0 -97
@@ -1 +1 @@
1
- {"version":3,"file":"sprite.js","names":[],"sources":["../../resources/js/icons/sprite.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\n// Augmentable registry of icon names. The sprite plugin can generate a\n// `declare module \"@lattice-php/lattice\" { interface KnownIcons { … } }` block\n// from the built sprite, which turns `IconName` into the real set for\n// autocomplete. Unaugmented it falls back to `string`, so any name still works.\nexport interface KnownIcons {}\nexport type IconName = keyof KnownIcons | (string & {});\n\nexport type SpriteValue = {\n /** The sprite URL. Empty when the sprite is inlined into the document (dev). */\n href: string;\n /** Every symbol id in the sprite, or undefined when not yet wired/known. */\n ids?: readonly string[];\n /** Inline sprite markup to inject once (dev); empty/omitted in builds. */\n source?: string;\n};\n\nconst SpriteContext = createContext<SpriteValue>({ href: \"\" });\n\n/**\n * Seeds the icon sprite for everything below it. When `sprite.source` is set\n * (dev), it's injected once so same-document `<use href=\"#id\">` references\n * resolve; in builds `href` points at the emitted sprite asset instead.\n */\nexport function SpriteProvider({ children, sprite }: { children: ReactNode; sprite: SpriteValue }) {\n return (\n <SpriteContext.Provider value={sprite}>\n {sprite.source ? <div hidden dangerouslySetInnerHTML={{ __html: sprite.source }} /> : null}\n {children}\n </SpriteContext.Provider>\n );\n}\n\nexport function useSprite(): SpriteValue {\n return useContext(SpriteContext);\n}\n\nconst warnedIcons = new Set<string>();\n\n/**\n * Renders a single sprite symbol by name. Used for Lattice's own UI chrome and\n * as the resolved default for server-driven icons. Extra `<svg>` props are\n * forwarded, so callers can override `aria-hidden`, set a `role`, etc.\n */\nexport function Icon({\n className,\n name,\n ...props\n}: { name: IconName } & React.ComponentProps<\"svg\">) {\n const { href, ids } = useSprite();\n\n if (import.meta.env.DEV && ids && !ids.includes(name) && !warnedIcons.has(name)) {\n warnedIcons.add(name);\n console.warn(`[Lattice] Icon \"${name}\" is not in the sprite.`);\n }\n\n return (\n <svg aria-hidden=\"true\" {...props} className={cn(\"size-lt-icon-md\", className)}>\n <use href={`${href}#${name}`} />\n </svg>\n );\n}\n"],"mappings":";;;;AAoBA,IAAM,gBAAgB,cAA2B,EAAE,MAAM,GAAG,CAAC;;;;;;AAO7D,SAAgB,eAAe,EAAE,UAAU,UAAwD;CACjG,OACE,qBAAC,cAAc,UAAf;EAAwB,OAAO;YAA/B,CACG,OAAO,SAAS,oBAAC,OAAD;GAAK,QAAA;GAAO,yBAAyB,EAAE,QAAQ,OAAO,OAAO;EAAI,CAAA,IAAI,MACrF,QACqB;;AAE5B;AAEA,SAAgB,YAAyB;CACvC,OAAO,WAAW,aAAa;AACjC;;;;;;AASA,SAAgB,KAAK,EACnB,WACA,MACA,GAAG,SACgD;CACnD,MAAM,EAAE,MAAM,QAAQ,UAAU;CAOhC,OACE,oBAAC,OAAD;EAAK,eAAY;EAAO,GAAI;EAAO,WAAW,GAAG,mBAAmB,SAAS;YAC3E,oBAAC,OAAD,EAAK,MAAM,GAAG,KAAK,GAAG,OAAS,CAAA;CAC5B,CAAA;AAET"}
1
+ {"version":3,"file":"sprite.js","names":[],"sources":["../../resources/js/icons/sprite.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\n// Augmentable registry of icon names. The sprite plugin can generate a\n// `declare module \"@lattice-php/lattice\" { interface KnownIcons { … } }` block\n// from the built sprite, which turns `IconName` into the real set for\n// autocomplete. Unaugmented it falls back to `string`, so any name still works.\nexport interface KnownIcons {}\nexport type IconName = keyof KnownIcons | (string & {});\n\nexport type SpriteValue = {\n /** The sprite URL. Empty when the sprite is inlined into the document (dev). */\n href: string;\n /** Every symbol id in the sprite, or undefined when not yet wired/known. */\n ids?: readonly string[];\n /** Inline sprite markup to inject once (dev); empty/omitted in builds. */\n source?: string;\n};\n\nconst SpriteContext = createContext<SpriteValue>({ href: \"\" });\n\n/**\n * Seeds the icon sprite for everything below it. When `sprite.source` is set\n * (dev), it's injected once so same-document `<use href=\"#id\">` references\n * resolve; in builds `href` points at the emitted sprite asset instead.\n */\nexport function SpriteProvider({ children, sprite }: { children: ReactNode; sprite: SpriteValue }) {\n return (\n <SpriteContext.Provider value={sprite}>\n {sprite.source ? <div hidden dangerouslySetInnerHTML={{ __html: sprite.source }} /> : null}\n {children}\n </SpriteContext.Provider>\n );\n}\n\nexport function useSprite(): SpriteValue {\n return useContext(SpriteContext);\n}\n\nconst warnedIcons = new Set<string>();\n\n/**\n * Renders a single sprite symbol by name. Used for Lattice's own UI chrome and\n * as the resolved default for server-driven icons. Extra `<svg>` props are\n * forwarded, so callers can override `aria-hidden`, set a `role`, etc.\n */\nexport function Icon({\n className,\n name,\n ...props\n}: { name: IconName } & React.ComponentProps<\"svg\">) {\n const { href, ids } = useSprite();\n\n if (import.meta.env.DEV && ids && !ids.includes(name) && !warnedIcons.has(name)) {\n warnedIcons.add(name);\n console.warn(`[Lattice] Icon \"${name}\" is not in the sprite.`);\n }\n\n return (\n <svg aria-hidden=\"true\" {...props} className={cn(\"size-lt-icon-md\", className)}>\n <use href={`${href}#${name}`} />\n </svg>\n );\n}\n"],"mappings":";;;;AAoBA,IAAM,gBAAgB,cAA2B,EAAE,MAAM,GAAG,CAAC;;;;;;AAO7D,SAAgB,eAAe,EAAE,UAAU,UAAwD;CACjG,OACE,qBAAC,cAAc,UAAf;EAAwB,OAAO;EAA/B,UAAA,CACG,OAAO,SAAS,oBAAC,OAAD;GAAK,QAAA;GAAO,yBAAyB,EAAE,QAAQ,OAAO,OAAO;EAAI,CAAA,IAAI,MACrF,QACqB;;AAE5B;AAEA,SAAgB,YAAyB;CACvC,OAAO,WAAW,aAAa;AACjC;;;;;;AASA,SAAgB,KAAK,EACnB,WACA,MACA,GAAG,SACgD;CACnD,MAAM,EAAE,MAAM,QAAQ,UAAU;CAOhC,OACE,oBAAC,OAAD;EAAK,eAAY;EAAO,GAAI;EAAO,WAAW,GAAG,mBAAmB,SAAS;EAC3E,UAAA,oBAAC,OAAD,EAAK,MAAM,GAAG,KAAK,GAAG,OAAS,CAAA;CAC5B,CAAA;AAET"}
@@ -1 +1 @@
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 { PagePayload, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { useT } from \"@lattice-php/lattice/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 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>\n {isLast ? (\n <span aria-current=\"page\" className=\"text-lt-fg\">\n {crumb.title}\n </span>\n ) : (\n <Link className=\"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":";;;;;;AAMA,IAAM,wBAA0D,EAAE,WAAW;CAC3E,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,MAAM,SADO,QACG,EAAK,MAAM,SAAqC,eAAe,CAAC;CAEhF,IAAI,OAAO,WAAW,GACpB,OAAO;CAGT,OACE,oBAAC,OAAD;EACE,cAAY,EAAE,qBAAqB,YAAY;EAC/C,0BAAwB,aAAa,IAAI;YAEzC,oBAAC,MAAD;GAAI,WAAU;aACX,OAAO,KAAK,OAAO,UAAU;IAC5B,MAAM,SAAS,UAAU,OAAO,SAAS;IAEzC,OACE,qBAAC,UAAD,EAAA,UAAA,CACE,oBAAC,MAAD,EAAA,UACG,SACC,oBAAC,QAAD;KAAM,gBAAa;KAAO,WAAU;eACjC,MAAM;IACH,CAAA,IAEN,oBAAC,MAAD;KAAM,WAAU;KAAmB,MAAM,MAAM;eAC5C,MAAM;IACH,CAAA,EAEN,CAAA,GACH,SAAS,OAAO,oBAAC,MAAD;KAAI,eAAY;eAAO;IAAK,CAAA,CACrC,EAAA,GAbK,MAAM,IAaX;GAEd,CAAC;EACC,CAAA;CACD,CAAA;AAET"}
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 { PagePayload, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { useT } from \"@lattice-php/lattice/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 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>\n {isLast ? (\n <span aria-current=\"page\" className=\"text-lt-fg\">\n {crumb.title}\n </span>\n ) : (\n <Link className=\"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":";;;;;;AAMA,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,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,EAAA,UACG,SACC,oBAAC,QAAD;KAAM,gBAAa;KAAO,WAAU;KACjC,UAAA,MAAM;IACH,CAAA,IAEN,oBAAC,MAAD;KAAM,WAAU;KAAmB,MAAM,MAAM;KAC5C,UAAA,MAAM;IACH,CAAA,EAEN,CAAA,GACH,SAAS,OAAO,oBAAC,MAAD;KAAI,eAAY;KAAO,UAAA;IAAK,CAAA,CACrC,EAAA,GAbK,MAAM,IAaX;GAEd,CAAC;EACC,CAAA;CACD,CAAA;AAET"}
@@ -8,7 +8,8 @@ import { RendererComponent } from '../../core/types.js';
8
8
  * `replace` instead and never fires it, so the callout survives until the
9
9
  * server overwrites or drops it. On these URL-changing visits, `navigate`
10
10
  * fires before `flash`, so re-assertion always wins over the clear and no
11
- * ordering guard is needed.
11
+ * ordering guard is needed. A `retract-callout` effect clears one on a
12
+ * same-URL response too.
12
13
  */
13
14
  declare const Callouts: RendererComponent<"callouts">;
14
15
  export default Callouts;
@@ -3,7 +3,7 @@ import { cn } from "../../lib/utils.js";
3
3
  import { Icon } from "../../icons/sprite.js";
4
4
  import { RenderNode } from "../../core/renderer.js";
5
5
  import { resolveText } from "../../i18n/translatable.js";
6
- import { onCallout } from "../../toast/callout.js";
6
+ import { onCallout, onRetractCallout } from "../../toast/callout.js";
7
7
  import { variantStyles } from "../../toast/variant-styles.js";
8
8
  import { router } from "@inertiajs/react";
9
9
  import { useEffect, useState } from "react";
@@ -19,7 +19,8 @@ var nextId = 0;
19
19
  * `replace` instead and never fires it, so the callout survives until the
20
20
  * server overwrites or drops it. On these URL-changing visits, `navigate`
21
21
  * fires before `flash`, so re-assertion always wins over the clear and no
22
- * ordering guard is needed.
22
+ * ordering guard is needed. A `retract-callout` effect clears one on a
23
+ * same-URL response too.
23
24
  */
24
25
  var Callouts = () => {
25
26
  const { t } = useT("lattice");
@@ -35,6 +36,9 @@ var Callouts = () => {
35
36
  useEffect(() => router.on("navigate", () => {
36
37
  setCallouts((current) => current.filter((callout) => !callout.unique));
37
38
  }), []);
39
+ useEffect(() => onRetractCallout((unique) => {
40
+ setCallouts((current) => current.filter((callout) => callout.unique !== unique));
41
+ }), []);
38
42
  function dismiss(id) {
39
43
  setCallouts((current) => current.filter((callout) => callout.id !== id));
40
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"callouts.js","names":[],"sources":["../../../resources/js/layout/components/callouts.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { router } from \"@inertiajs/react\";\nimport { useEffect, useState } from \"react\";\nimport { RenderNode } from \"@lattice-php/lattice/core/renderer\";\nimport type { Callout } from \"@lattice-php/lattice/types/generated\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { onCallout } from \"@lattice-php/lattice/toast\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { resolveText } from \"@lattice-php/lattice/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.\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 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;;;;;;;;;;;;AAab,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,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;YACZ,SAAS,KAAK,YACb,qBAAC,OAAD;GAEE,MAAK;GACL,aAAW,WAAW,QAAQ;GAC9B,WAAW,GACT,6GACA,cAAc,QAAQ,SAAS,MACjC;aAPF;IASG,cAAc,QAAQ,SAAS;IAChC,qBAAC,OAAD;KAAK,WAAU;eAAf;MACG,QAAQ,QACP,oBAAC,KAAD;OAAG,WAAU;iBAAkC,YAAY,QAAQ,OAAO,CAAC;MAAK,CAAA,IAC9E;MACJ,oBAAC,KAAD;OAAG,WAAU;iBAAsB,YAAY,QAAQ,SAAS,CAAC;MAAK,CAAA;MACrE,QAAQ,SACP,oBAAC,OAAD;OAAK,WAAU;iBACb,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;eAEjC,oBAAC,MAAD;MAAM,MAAK;MAAI,WAAU;KAAmB,CAAA;IACtC,CAAA,IACN;GACD;KA/BE,QAAQ,EA+BV,CACN;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"callouts.js","names":[],"sources":["../../../resources/js/layout/components/callouts.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { router } from \"@inertiajs/react\";\nimport { useEffect, useState } from \"react\";\nimport { RenderNode } from \"@lattice-php/lattice/core/renderer\";\nimport type { Callout } from \"@lattice-php/lattice/types/generated\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { onCallout, onRetractCallout } from \"@lattice-php/lattice/toast\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { resolveText } from \"@lattice-php/lattice/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":";;;;;;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AA,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 +1 @@
1
- {"version":3,"file":"dropdown.js","names":[],"sources":["../../../resources/js/layout/components/dropdown.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { RenderNode } from \"@lattice-php/lattice/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;aACb,KAAK,MAAM,QAAQ,KAAK,aAAa,UACpC,oBAAC,YAAD,EAEE,MAAM,YACP,GAFM,YAAY,OAAO,GAAG,YAAY,KAAK,GAAG,OAEhD,CACF;EACG,CAAA;YAGR,oBAAC,MAAD;GAAI,WAAU;GAAuB;EAAa,CAAA;CAC3C,CAAA;AAEb"}
1
+ {"version":3,"file":"dropdown.js","names":[],"sources":["../../../resources/js/layout/components/dropdown.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { RenderNode } from \"@lattice-php/lattice/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 +1 @@
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/lattice/core/test-id\";\nimport type { RendererComponent, Schema } from \"@lattice-php/lattice/core/types\";\nimport { Icon, IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Affix } from \"@lattice-php/lattice/types/generated\";\nimport {\n ActionTrigger,\n type TriggerState,\n useClickBehavior,\n} from \"@lattice-php/lattice/ui/click-behavior\";\nimport { useSidebarCollapsed } from \"@lattice-php/lattice/layout/hooks/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 = useSidebarCollapsed();\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\") {\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":";;;;;;;;;;;AAgBA,IAAM,WACJ;AAEF,SAAS,UAAU,EAAE,OAAO,aAAmD;CAC7E,IAAI,MAAM,MACR,OAAO,oBAAC,cAAD;EAAc,WAAW,GAAG,4BAA4B,SAAS;EAAG,MAAM,MAAM;CAAO,CAAA;CAGhG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,qCAAqC,SAAS;YAAI,MAAM;CAAW,CAAA;AAChG;AAEA,SAAS,mBAAmB,QAA4B,MAAuB;CAC7E,QAAQ,UAAU,CAAC,GAAG,MACnB,UAAU,MAAM,OAAO,SAAS,QAAQ,mBAAmB,MAAM,QAAQ,IAAI,CAChF;AACF;AAEA,IAAM,qBAAqD,EAAE,UAAU,WAAW;CAChF,MAAM,YAAY,aAAoB;CACtC,MAAM,EAAE,MAAM,OAAO,UAAU,QAAQ,WAAW,KAAK;CACvD,MAAM,QAAQ,YAAY;CAC1B,MAAM,WAAW,QAAQ,IAAI;CAC7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[],"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/lattice/core/test-id\";\nimport type { RendererComponent, Schema } from \"@lattice-php/lattice/core/types\";\nimport { Icon, IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Affix } from \"@lattice-php/lattice/types/generated\";\nimport {\n ActionTrigger,\n type TriggerState,\n useClickBehavior,\n} from \"@lattice-php/lattice/ui/click-behavior\";\nimport { useSidebarCollapsed } from \"@lattice-php/lattice/layout/hooks/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 = useSidebarCollapsed();\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\") {\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":";;;;;;;;;;;AAgBA,IAAM,WACJ;AAEF,SAAS,UAAU,EAAE,OAAO,aAAmD;CAC7E,IAAI,MAAM,MACR,OAAO,oBAAC,cAAD;EAAc,WAAW,GAAG,4BAA4B,SAAS;EAAG,MAAM,MAAM;CAAO,CAAA;CAGhG,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,qCAAqC,SAAS;EAAI,UAAA,MAAM;CAAW,CAAA;AAChG;AAEA,SAAS,mBAAmB,QAA4B,MAAuB;CAC7E,QAAQ,UAAU,CAAC,EAAA,CAAG,MACnB,UAAU,MAAM,OAAO,SAAS,QAAQ,mBAAmB,MAAM,QAAQ,IAAI,CAChF;AACF;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EhE,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;EAGvB,kBAAkB,GAAG,UAAU,gBAAgB;EAC/C,cAAc;EAEd,UAAA,qBAAC,MAAD;GAAI,WAAU;GAAd,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IACX,UAAA;GACC,CAAA,GACH,QACC;;CACG,CAAA,EACP,CAAA;AAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","names":[],"sources":["../../../resources/js/layout/components/menu.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { nodeIdentity } from \"@lattice-php/lattice/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;WAC5C,oBAAC,MAAD;EAAI,WAAU;EAAuB;CAAa,CAAA;AAC/C,CAAA"}
1
+ {"version":3,"file":"menu.js","names":[],"sources":["../../../resources/js/layout/components/menu.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { nodeIdentity } from \"@lattice-php/lattice/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 +1 @@
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/lattice/ui/popover\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { CollapsedContext } from \"@lattice-php/lattice/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 <CollapsedContext.Provider value={false}>{children}</CollapsedContext.Provider>\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,EAAE;CAEtB,gBAAgB,QAAQ,KAAK,GAAG,CAAC,GAAG,CAAC;CAErC,OACE,qBAAC,WAAD;EAAmB;EAAM,cAAc;YAAvC,CACE,oBAAC,gBAAD;GAAgB,SAAA;aACd,oBAAC,UAAD;IACE,cAAY;IACZ,WAAW,GAAG,UAAU,gBAAgB;IACxC,aAAW;IACX,OAAO;IACP,MAAK;cAEJ;GACK,CAAA;EACM,CAAA,GAChB,oBAAC,gBAAD;GACS;GACP,WAAW,GAAG,gBAAgB,SAAS;GACvC,MAAK;GACL,MAAM;aAEN,oBAAC,iBAAiB,UAAlB;IAA2B,OAAO;IAAQ;GAAoC,CAAA;EAChE,CAAA,CACL;;AAEjB"}
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/lattice/ui/popover\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { CollapsedContext } from \"@lattice-php/lattice/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 <CollapsedContext.Provider value={false}>{children}</CollapsedContext.Provider>\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,iBAAiB,UAAlB;IAA2B,OAAO;IAAQ;GAAoC,CAAA;EAChE,CAAA,CACL;;AAEjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema-layout.js","names":[],"sources":["../../../resources/js/layout/components/schema-layout.tsx"],"sourcesContent":["import { usePage } from \"@inertiajs/react\";\nimport type { ReactNode } from \"react\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport type { PagePayload } from \"@lattice-php/lattice/core/types\";\nimport { OutletContext } from \"@lattice-php/lattice/layout/hooks/context\";\n\n/**\n * Persistent Inertia layout that renders a server-composed layout schema and\n * exposes the active page (`children`) to the Outlet via context. The same\n * component instance is reused across navigations that share a layout, so\n * shell state (open sidebar, scroll position) survives page visits.\n */\nexport default function SchemaLayout({ children }: { children: ReactNode }) {\n const lattice = usePage().props.lattice as PagePayload;\n const layout = lattice.layout;\n\n if (!layout) {\n return <>{children}</>;\n }\n\n return (\n <OutletContext.Provider value={children}>\n <Renderer nodes={layout.schema} />\n </OutletContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAwB,aAAa,EAAE,YAAqC;CAE1E,MAAM,SADU,QAAQ,EAAE,MAAM,QACT;CAEvB,IAAI,CAAC,QACH,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;CAGvB,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,oBAAC,UAAD,EAAU,OAAO,OAAO,OAAS,CAAA;CACX,CAAA;AAE5B"}
1
+ {"version":3,"file":"schema-layout.js","names":[],"sources":["../../../resources/js/layout/components/schema-layout.tsx"],"sourcesContent":["import { usePage } from \"@inertiajs/react\";\nimport type { ReactNode } from \"react\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport type { PagePayload } from \"@lattice-php/lattice/core/types\";\nimport { OutletContext } from \"@lattice-php/lattice/layout/hooks/context\";\n\n/**\n * Persistent Inertia layout that renders a server-composed layout schema and\n * exposes the active page (`children`) to the Outlet via context. The same\n * component instance is reused across navigations that share a layout, so\n * shell state (open sidebar, scroll position) survives page visits.\n */\nexport default function SchemaLayout({ children }: { children: ReactNode }) {\n const lattice = usePage().props.lattice as PagePayload;\n const layout = lattice.layout;\n\n if (!layout) {\n return <>{children}</>;\n }\n\n return (\n <OutletContext.Provider value={children}>\n <Renderer nodes={layout.schema} />\n </OutletContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAwB,aAAa,EAAE,YAAqC;CAE1E,MAAM,SADU,QAAQ,CAAC,CAAC,MAAM,QACT;CAEvB,IAAI,CAAC,QACH,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;CAGvB,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC7B,UAAA,oBAAC,UAAD,EAAU,OAAO,OAAO,OAAS,CAAA;CACX,CAAA;AAE5B"}
@@ -1 +1 @@
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/lattice/core/types\";\nimport { CollapsedContext } from \"@lattice-php/lattice/core/collapsed-context\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/core/event-names\";\nimport { useWindowEvent } from \"@lattice-php/lattice/core/hooks/use-window-event\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useMediaQuery } from \"@lattice-php/lattice/lib/use-media-query\";\nimport { useCollapsibleState } from \"@lattice-php/lattice/ui/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 <CollapsedContext.Provider value={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 </CollapsedContext.Provider>\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,EAAE,WAAW;OAC5C,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,iBAAiB,UAAlB;EAA2B,OAAO;YAAlC,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,CACkB;;AAE/B"}
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/lattice/core/types\";\nimport { CollapsedContext } from \"@lattice-php/lattice/core/collapsed-context\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/core/event-names\";\nimport { useWindowEvent } from \"@lattice-php/lattice/core/hooks/use-window-event\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { useMediaQuery } from \"@lattice-php/lattice/lib/use-media-query\";\nimport { useCollapsibleState } from \"@lattice-php/lattice/ui/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 <CollapsedContext.Provider value={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 </CollapsedContext.Provider>\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,iBAAiB,UAAlB;EAA2B,OAAO;EAAlC,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,CACkB;;AAE/B"}
package/dist/lib/color.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region resources/js/lib/color.ts
2
- var names = new Set([
2
+ var names = /* @__PURE__ */ new Set([
3
3
  "default",
4
4
  "muted",
5
5
  "primary",
@@ -1 +1 @@
1
- {"version":3,"file":"color.js","names":[],"sources":["../../resources/js/lib/color.ts"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport type { Color, ColorName } from \"@lattice-php/lattice/types/generated\";\n\nconst names: ReadonlySet<string> = new Set([\n \"default\",\n \"muted\",\n \"primary\",\n \"success\",\n \"info\",\n \"warning\",\n \"danger\",\n \"gray\",\n \"red\",\n \"orange\",\n \"yellow\",\n \"green\",\n \"blue\",\n \"purple\",\n] satisfies ColorName[]);\n\nexport function namedColor(value: ColorName): Color {\n return { kind: \"named\", value, dark: null };\n}\n\nexport function coerceColor(value: unknown): Color | undefined {\n if (typeof value === \"string\" && value !== \"\") {\n return names.has(value) ? namedColor(value as ColorName) : { kind: \"css\", value, dark: null };\n }\n\n if (typeof value === \"object\" && value !== null && \"kind\" in value && \"value\" in value) {\n return value as Color;\n }\n\n return undefined;\n}\n\nexport function colorValue(color: Color): string {\n if (color.kind === \"named\") {\n return `var(--lt-color-${color.value})`;\n }\n\n return color.dark === null ? color.value : `light-dark(${color.value}, ${color.dark})`;\n}\n\nexport function toneProps(color: Color): { className?: string; style?: CSSProperties } {\n if (color.kind === \"named\") {\n return { className: `lt-tone-${color.value}` };\n }\n\n const paint = colorValue(color);\n\n return {\n style: {\n \"--lt-tone-bg\": `color-mix(in oklab, ${paint} 12%, transparent)`,\n \"--lt-tone-fg\": paint,\n } as CSSProperties,\n };\n}\n"],"mappings":";AAGA,IAAM,QAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAuB;AAEvB,SAAgB,WAAW,OAAyB;CAClD,OAAO;EAAE,MAAM;EAAS;EAAO,MAAM;CAAK;AAC5C;AAEA,SAAgB,YAAY,OAAmC;CAC7D,IAAI,OAAO,UAAU,YAAY,UAAU,IACzC,OAAO,MAAM,IAAI,KAAK,IAAI,WAAW,KAAkB,IAAI;EAAE,MAAM;EAAO;EAAO,MAAM;CAAK;CAG9F,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,WAAW,OAC/E,OAAO;AAIX;AAEA,SAAgB,WAAW,OAAsB;CAC/C,IAAI,MAAM,SAAS,SACjB,OAAO,kBAAkB,MAAM,MAAM;CAGvC,OAAO,MAAM,SAAS,OAAO,MAAM,QAAQ,cAAc,MAAM,MAAM,IAAI,MAAM,KAAK;AACtF;AAEA,SAAgB,UAAU,OAA6D;CACrF,IAAI,MAAM,SAAS,SACjB,OAAO,EAAE,WAAW,WAAW,MAAM,QAAQ;CAG/C,MAAM,QAAQ,WAAW,KAAK;CAE9B,OAAO,EACL,OAAO;EACL,gBAAgB,uBAAuB,MAAM;EAC7C,gBAAgB;CAClB,EACF;AACF"}
1
+ {"version":3,"file":"color.js","names":[],"sources":["../../resources/js/lib/color.ts"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport type { Color, ColorName } from \"@lattice-php/lattice/types/generated\";\n\nconst names: ReadonlySet<string> = new Set([\n \"default\",\n \"muted\",\n \"primary\",\n \"success\",\n \"info\",\n \"warning\",\n \"danger\",\n \"gray\",\n \"red\",\n \"orange\",\n \"yellow\",\n \"green\",\n \"blue\",\n \"purple\",\n] satisfies ColorName[]);\n\nexport function namedColor(value: ColorName): Color {\n return { kind: \"named\", value, dark: null };\n}\n\nexport function coerceColor(value: unknown): Color | undefined {\n if (typeof value === \"string\" && value !== \"\") {\n return names.has(value) ? namedColor(value as ColorName) : { kind: \"css\", value, dark: null };\n }\n\n if (typeof value === \"object\" && value !== null && \"kind\" in value && \"value\" in value) {\n return value as Color;\n }\n\n return undefined;\n}\n\nexport function colorValue(color: Color): string {\n if (color.kind === \"named\") {\n return `var(--lt-color-${color.value})`;\n }\n\n return color.dark === null ? color.value : `light-dark(${color.value}, ${color.dark})`;\n}\n\nexport function toneProps(color: Color): { className?: string; style?: CSSProperties } {\n if (color.kind === \"named\") {\n return { className: `lt-tone-${color.value}` };\n }\n\n const paint = colorValue(color);\n\n return {\n style: {\n \"--lt-tone-bg\": `color-mix(in oklab, ${paint} 12%, transparent)`,\n \"--lt-tone-fg\": paint,\n } as CSSProperties,\n };\n}\n"],"mappings":";AAGA,IAAM,wBAA6B,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAuB;AAEvB,SAAgB,WAAW,OAAyB;CAClD,OAAO;EAAE,MAAM;EAAS;EAAO,MAAM;CAAK;AAC5C;AAEA,SAAgB,YAAY,OAAmC;CAC7D,IAAI,OAAO,UAAU,YAAY,UAAU,IACzC,OAAO,MAAM,IAAI,KAAK,IAAI,WAAW,KAAkB,IAAI;EAAE,MAAM;EAAO;EAAO,MAAM;CAAK;CAG9F,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,WAAW,OAC/E,OAAO;AAIX;AAEA,SAAgB,WAAW,OAAsB;CAC/C,IAAI,MAAM,SAAS,SACjB,OAAO,kBAAkB,MAAM,MAAM;CAGvC,OAAO,MAAM,SAAS,OAAO,MAAM,QAAQ,cAAc,MAAM,MAAM,IAAI,MAAM,KAAK;AACtF;AAEA,SAAgB,UAAU,OAA6D;CACrF,IAAI,MAAM,SAAS,SACjB,OAAO,EAAE,WAAW,WAAW,MAAM,QAAQ;CAG/C,MAAM,QAAQ,WAAW,KAAK;CAE9B,OAAO,EACL,OAAO;EACL,gBAAgB,uBAAuB,MAAM;EAC7C,gBAAgB;CAClB,EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-media-query.js","names":[],"sources":["../../resources/js/lib/use-media-query.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nfunction matches(query: string, fallback: boolean): boolean {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return fallback;\n }\n\n return window.matchMedia(query).matches;\n}\n\n/**\n * Track a CSS media query. `fallback` is the SSR / no-`matchMedia` value and the\n * initial state before the effect subscribes.\n */\nexport function useMediaQuery(query: string, fallback = false): boolean {\n const [state, setState] = useState(() => matches(query, fallback));\n\n useEffect(() => {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return;\n }\n\n const media = window.matchMedia(query);\n const update = (): void => setState(media.matches);\n\n update();\n media.addEventListener(\"change\", update);\n\n return () => media.removeEventListener(\"change\", update);\n }, [query]);\n\n return state;\n}\n"],"mappings":";;AAEA,SAAS,QAAQ,OAAe,UAA4B;CAC1D,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE,OAAO;CAGT,OAAO,OAAO,WAAW,KAAK,EAAE;AAClC;;;;;AAMA,SAAgB,cAAc,OAAe,WAAW,OAAgB;CACtE,MAAM,CAAC,OAAO,YAAY,eAAe,QAAQ,OAAO,QAAQ,CAAC;CAEjE,gBAAgB;EACd,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE;EAGF,MAAM,QAAQ,OAAO,WAAW,KAAK;EACrC,MAAM,eAAqB,SAAS,MAAM,OAAO;EAEjD,OAAO;EACP,MAAM,iBAAiB,UAAU,MAAM;EAEvC,aAAa,MAAM,oBAAoB,UAAU,MAAM;CACzD,GAAG,CAAC,KAAK,CAAC;CAEV,OAAO;AACT"}
1
+ {"version":3,"file":"use-media-query.js","names":[],"sources":["../../resources/js/lib/use-media-query.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nfunction matches(query: string, fallback: boolean): boolean {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return fallback;\n }\n\n return window.matchMedia(query).matches;\n}\n\n/**\n * Track a CSS media query. `fallback` is the SSR / no-`matchMedia` value and the\n * initial state before the effect subscribes.\n */\nexport function useMediaQuery(query: string, fallback = false): boolean {\n const [state, setState] = useState(() => matches(query, fallback));\n\n useEffect(() => {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return;\n }\n\n const media = window.matchMedia(query);\n const update = (): void => setState(media.matches);\n\n update();\n media.addEventListener(\"change\", update);\n\n return () => media.removeEventListener(\"change\", update);\n }, [query]);\n\n return state;\n}\n"],"mappings":";;AAEA,SAAS,QAAQ,OAAe,UAA4B;CAC1D,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE,OAAO;CAGT,OAAO,OAAO,WAAW,KAAK,CAAC,CAAC;AAClC;;;;;AAMA,SAAgB,cAAc,OAAe,WAAW,OAAgB;CACtE,MAAM,CAAC,OAAO,YAAY,eAAe,QAAQ,OAAO,QAAQ,CAAC;CAEjE,gBAAgB;EACd,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE;EAGF,MAAM,QAAQ,OAAO,WAAW,KAAK;EACrC,MAAM,eAAqB,SAAS,MAAM,OAAO;EAEjD,OAAO;EACP,MAAM,iBAAiB,UAAU,MAAM;EAEvC,aAAa,MAAM,oBAAoB,UAAU,MAAM;CACzD,GAAG,CAAC,KAAK,CAAC;CAEV,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.js","names":[],"sources":["../../../resources/js/notifications/components/empty-state.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\nexport function EmptyState() {\n const { t } = useT(\"lattice\");\n return (\n <div className=\"flex flex-col items-center gap-2 px-4 py-10 text-lt-muted-fg\">\n <Icon name=\"bell\" className=\"size-lt-icon-lg\" />\n <p className=\"text-sm\">{t(\"notifications.empty\", \"No notifications yet\")}</p>\n </div>\n );\n}\n"],"mappings":";;;;AAGA,SAAgB,aAAa;CAC3B,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,MAAD;GAAM,MAAK;GAAO,WAAU;EAAmB,CAAA,GAC/C,oBAAC,KAAD;GAAG,WAAU;aAAW,EAAE,uBAAuB,sBAAsB;EAAK,CAAA,CACzE;;AAET"}
1
+ {"version":3,"file":"empty-state.js","names":[],"sources":["../../../resources/js/notifications/components/empty-state.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\nexport function EmptyState() {\n const { t } = useT(\"lattice\");\n return (\n <div className=\"flex flex-col items-center gap-2 px-4 py-10 text-lt-muted-fg\">\n <Icon name=\"bell\" className=\"size-lt-icon-lg\" />\n <p className=\"text-sm\">{t(\"notifications.empty\", \"No notifications yet\")}</p>\n </div>\n );\n}\n"],"mappings":";;;;AAGA,SAAgB,aAAa;CAC3B,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,MAAD;GAAM,MAAK;GAAO,WAAU;EAAmB,CAAA,GAC/C,oBAAC,KAAD;GAAG,WAAU;GAAW,UAAA,EAAE,uBAAuB,sBAAsB;EAAK,CAAA,CACzE;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"notification-item.js","names":[],"sources":["../../../resources/js/notifications/components/notification-item.tsx"],"sourcesContent":["import { Link } from \"@inertiajs/react\";\nimport { RenderNode } from \"@lattice-php/lattice/core/renderer\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { resolveText } from \"@lattice-php/lattice/i18n/translatable\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { NotificationItem } from \"@lattice-php/lattice/notifications/types\";\n\nconst variantIconClass: Record<NonNullable<NotificationItem[\"variant\"]>, string> = {\n primary: \"text-lt-primary\",\n secondary: \"text-lt-muted-fg\",\n success: \"text-lt-success\",\n info: \"text-lt-info\",\n warning: \"text-lt-warning\",\n danger: \"text-lt-danger\",\n};\n\nexport function NotificationItemRow({\n notification,\n onMarkRead,\n onDismiss,\n}: {\n notification: NotificationItem;\n onMarkRead: (id: string) => void;\n onDismiss: (id: string) => void;\n}) {\n const { t } = useT(\"lattice\");\n\n const title = resolveText(notification.title, t);\n const body = resolveText(notification.body, t);\n\n const content = (\n <>\n {title ? <p className=\"truncate text-sm font-medium text-lt-fg\">{title}</p> : null}\n {body ? <p className=\"text-sm text-lt-muted-fg\">{body}</p> : null}\n </>\n );\n\n return (\n <li\n className={cn(\"flex gap-3 px-3 py-3\", !notification.isRead && \"bg-lt-muted/40\")}\n data-test=\"notification\"\n >\n {notification.icon ? (\n <IconRenderer\n icon={notification.icon}\n className={cn(\n \"mt-0.5 size-lt-icon-md\",\n notification.variant ? variantIconClass[notification.variant] : undefined,\n )}\n />\n ) : null}\n <div className=\"min-w-0 flex-1\">\n {notification.href ? (\n <Link\n href={notification.href}\n className=\"block\"\n data-test=\"notification-link\"\n onClick={() => onMarkRead(notification.id)}\n >\n {content}\n </Link>\n ) : (\n content\n )}\n {notification.actions.length > 0 ? (\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {notification.actions.map((node, index) => (\n <RenderNode key={node.key ?? node.id ?? `action-${index}`} node={node} />\n ))}\n </div>\n ) : null}\n </div>\n <div className=\"flex shrink-0 flex-col gap-1\">\n {!notification.isRead ? (\n <button\n type=\"button\"\n className=\"text-xs text-lt-muted-fg hover:text-lt-fg\"\n onClick={() => onMarkRead(notification.id)}\n >\n {t(\"notifications.mark-read\", \"Mark read\")}\n </button>\n ) : null}\n <button\n type=\"button\"\n aria-label={t(\"notifications.dismiss\", \"Dismiss\")}\n className=\"text-xs text-lt-muted-fg hover:text-lt-fg\"\n onClick={() => onDismiss(notification.id)}\n >\n {t(\"notifications.dismiss\", \"Dismiss\")}\n </button>\n </div>\n </li>\n );\n}\n"],"mappings":";;;;;;;;AAQA,IAAM,mBAA6E;CACjF,SAAS;CACT,WAAW;CACX,SAAS;CACT,MAAM;CACN,SAAS;CACT,QAAQ;AACV;AAEA,SAAgB,oBAAoB,EAClC,cACA,YACA,aAKC;CACD,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,MAAM,QAAQ,YAAY,aAAa,OAAO,CAAC;CAC/C,MAAM,OAAO,YAAY,aAAa,MAAM,CAAC;CAE7C,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA,CACG,QAAQ,oBAAC,KAAD;EAAG,WAAU;YAA2C;CAAS,CAAA,IAAI,MAC7E,OAAO,oBAAC,KAAD;EAAG,WAAU;YAA4B;CAAQ,CAAA,IAAI,IAC7D,EAAA,CAAA;CAGJ,OACE,qBAAC,MAAD;EACE,WAAW,GAAG,wBAAwB,CAAC,aAAa,UAAU,gBAAgB;EAC9E,aAAU;YAFZ;GAIG,aAAa,OACZ,oBAAC,cAAD;IACE,MAAM,aAAa;IACnB,WAAW,GACT,0BACA,aAAa,UAAU,iBAAiB,aAAa,WAAW,KAAA,CAClE;GACD,CAAA,IACC;GACJ,qBAAC,OAAD;IAAK,WAAU;cAAf,CACG,aAAa,OACZ,oBAAC,MAAD;KACE,MAAM,aAAa;KACnB,WAAU;KACV,aAAU;KACV,eAAe,WAAW,aAAa,EAAE;eAExC;IACG,CAAA,IAEN,SAED,aAAa,QAAQ,SAAS,IAC7B,oBAAC,OAAD;KAAK,WAAU;eACZ,aAAa,QAAQ,KAAK,MAAM,UAC/B,oBAAC,YAAD,EAAiE,KAAO,GAAvD,KAAK,OAAO,KAAK,MAAM,UAAU,OAAsB,CACzE;IACE,CAAA,IACH,IACD;;GACL,qBAAC,OAAD;IAAK,WAAU;cAAf,CACG,CAAC,aAAa,SACb,oBAAC,UAAD;KACE,MAAK;KACL,WAAU;KACV,eAAe,WAAW,aAAa,EAAE;eAExC,EAAE,2BAA2B,WAAW;IACnC,CAAA,IACN,MACJ,oBAAC,UAAD;KACE,MAAK;KACL,cAAY,EAAE,yBAAyB,SAAS;KAChD,WAAU;KACV,eAAe,UAAU,aAAa,EAAE;eAEvC,EAAE,yBAAyB,SAAS;IAC/B,CAAA,CACL;;EACH;;AAER"}
1
+ {"version":3,"file":"notification-item.js","names":[],"sources":["../../../resources/js/notifications/components/notification-item.tsx"],"sourcesContent":["import { Link } from \"@inertiajs/react\";\nimport { RenderNode } from \"@lattice-php/lattice/core/renderer\";\nimport { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { resolveText } from \"@lattice-php/lattice/i18n/translatable\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { NotificationItem } from \"@lattice-php/lattice/notifications/types\";\n\nconst variantIconClass: Record<NonNullable<NotificationItem[\"variant\"]>, string> = {\n primary: \"text-lt-primary\",\n secondary: \"text-lt-muted-fg\",\n success: \"text-lt-success\",\n info: \"text-lt-info\",\n warning: \"text-lt-warning\",\n danger: \"text-lt-danger\",\n};\n\nexport function NotificationItemRow({\n notification,\n onMarkRead,\n onDismiss,\n}: {\n notification: NotificationItem;\n onMarkRead: (id: string) => void;\n onDismiss: (id: string) => void;\n}) {\n const { t } = useT(\"lattice\");\n\n const title = resolveText(notification.title, t);\n const body = resolveText(notification.body, t);\n\n const content = (\n <>\n {title ? <p className=\"truncate text-sm font-medium text-lt-fg\">{title}</p> : null}\n {body ? <p className=\"text-sm text-lt-muted-fg\">{body}</p> : null}\n </>\n );\n\n return (\n <li\n className={cn(\"flex gap-3 px-3 py-3\", !notification.isRead && \"bg-lt-muted/40\")}\n data-test=\"notification\"\n >\n {notification.icon ? (\n <IconRenderer\n icon={notification.icon}\n className={cn(\n \"mt-0.5 size-lt-icon-md\",\n notification.variant ? variantIconClass[notification.variant] : undefined,\n )}\n />\n ) : null}\n <div className=\"min-w-0 flex-1\">\n {notification.href ? (\n <Link\n href={notification.href}\n className=\"block\"\n data-test=\"notification-link\"\n onClick={() => onMarkRead(notification.id)}\n >\n {content}\n </Link>\n ) : (\n content\n )}\n {notification.actions.length > 0 ? (\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {notification.actions.map((node, index) => (\n <RenderNode key={node.key ?? node.id ?? `action-${index}`} node={node} />\n ))}\n </div>\n ) : null}\n </div>\n <div className=\"flex shrink-0 flex-col gap-1\">\n {!notification.isRead ? (\n <button\n type=\"button\"\n className=\"text-xs text-lt-muted-fg hover:text-lt-fg\"\n onClick={() => onMarkRead(notification.id)}\n >\n {t(\"notifications.mark-read\", \"Mark read\")}\n </button>\n ) : null}\n <button\n type=\"button\"\n aria-label={t(\"notifications.dismiss\", \"Dismiss\")}\n className=\"text-xs text-lt-muted-fg hover:text-lt-fg\"\n onClick={() => onDismiss(notification.id)}\n >\n {t(\"notifications.dismiss\", \"Dismiss\")}\n </button>\n </div>\n </li>\n );\n}\n"],"mappings":";;;;;;;;AAQA,IAAM,mBAA6E;CACjF,SAAS;CACT,WAAW;CACX,SAAS;CACT,MAAM;CACN,SAAS;CACT,QAAQ;AACV;AAEA,SAAgB,oBAAoB,EAClC,cACA,YACA,aAKC;CACD,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,MAAM,QAAQ,YAAY,aAAa,OAAO,CAAC;CAC/C,MAAM,OAAO,YAAY,aAAa,MAAM,CAAC;CAE7C,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA,CACG,QAAQ,oBAAC,KAAD;EAAG,WAAU;EAA2C,UAAA;CAAS,CAAA,IAAI,MAC7E,OAAO,oBAAC,KAAD;EAAG,WAAU;EAA4B,UAAA;CAAQ,CAAA,IAAI,IAC7D,EAAA,CAAA;CAGJ,OACE,qBAAC,MAAD;EACE,WAAW,GAAG,wBAAwB,CAAC,aAAa,UAAU,gBAAgB;EAC9E,aAAU;EAFZ,UAAA;GAIG,aAAa,OACZ,oBAAC,cAAD;IACE,MAAM,aAAa;IACnB,WAAW,GACT,0BACA,aAAa,UAAU,iBAAiB,aAAa,WAAW,KAAA,CAClE;GACD,CAAA,IACC;GACJ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,aAAa,OACZ,oBAAC,MAAD;KACE,MAAM,aAAa;KACnB,WAAU;KACV,aAAU;KACV,eAAe,WAAW,aAAa,EAAE;KAExC,UAAA;IACG,CAAA,IAEN,SAED,aAAa,QAAQ,SAAS,IAC7B,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,aAAa,QAAQ,KAAK,MAAM,UAC/B,oBAAC,YAAD,EAAiE,KAAO,GAAvD,KAAK,OAAO,KAAK,MAAM,UAAU,OAAsB,CACzE;IACE,CAAA,IACH,IACD;;GACL,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,CAAC,aAAa,SACb,oBAAC,UAAD;KACE,MAAK;KACL,WAAU;KACV,eAAe,WAAW,aAAa,EAAE;KAExC,UAAA,EAAE,2BAA2B,WAAW;IACnC,CAAA,IACN,MACJ,oBAAC,UAAD;KACE,MAAK;KACL,cAAY,EAAE,yBAAyB,SAAS;KAChD,WAAU;KACV,eAAe,UAAU,aAAa,EAAE;KAEvC,UAAA,EAAE,yBAAyB,SAAS;IAC/B,CAAA,CACL;;EACH;;AAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"notification-list.js","names":[],"sources":["../../../resources/js/notifications/components/notification-list.tsx"],"sourcesContent":["import { Skeleton } from \"@lattice-php/lattice/ui/skeleton\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { NotificationItem } from \"@lattice-php/lattice/notifications/types\";\nimport type { NotificationsStatus } from \"@lattice-php/lattice/notifications/store\";\nimport { EmptyState } from \"./empty-state\";\nimport { NotificationItemRow } from \"./notification-item\";\n\nexport function NotificationList({\n notifications,\n status,\n hasMore,\n onMarkRead,\n onDismiss,\n onLoadMore,\n}: {\n notifications: NotificationItem[];\n status: NotificationsStatus;\n hasMore: boolean;\n onMarkRead: (id: string) => void;\n onDismiss: (id: string) => void;\n onLoadMore: () => void;\n}) {\n const { t } = useT(\"lattice\");\n\n if (status === \"loading\" && notifications.length === 0) {\n return (\n <div className=\"space-y-2 p-3\">\n <Skeleton className=\"h-12 w-full\" />\n <Skeleton className=\"h-12 w-full\" />\n <Skeleton className=\"h-12 w-full\" />\n </div>\n );\n }\n\n if (notifications.length === 0) {\n return <EmptyState />;\n }\n\n return (\n <div className=\"max-h-96 overflow-y-auto\">\n <ul className=\"divide-y divide-lt-border\">\n {notifications.map((notification) => (\n <NotificationItemRow\n key={notification.id}\n notification={notification}\n onMarkRead={onMarkRead}\n onDismiss={onDismiss}\n />\n ))}\n </ul>\n {hasMore ? (\n <button\n type=\"button\"\n className=\"w-full py-2 text-sm text-lt-muted-fg hover:text-lt-fg\"\n onClick={onLoadMore}\n >\n {t(\"notifications.load-more\", \"Load more\")}\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAOA,SAAgB,iBAAiB,EAC/B,eACA,QACA,SACA,YACA,WACA,cAQC;CACD,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,IAAI,WAAW,aAAa,cAAc,WAAW,GACnD,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;GACnC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;GACnC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;EAChC;;CAIT,IAAI,cAAc,WAAW,GAC3B,OAAO,oBAAC,YAAD,CAAa,CAAA;CAGtB,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,MAAD;GAAI,WAAU;aACX,cAAc,KAAK,iBAClB,oBAAC,qBAAD;IAEgB;IACF;IACD;GACZ,GAJM,aAAa,EAInB,CACF;EACC,CAAA,GACH,UACC,oBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,SAAS;aAER,EAAE,2BAA2B,WAAW;EACnC,CAAA,IACN,IACD;;AAET"}
1
+ {"version":3,"file":"notification-list.js","names":[],"sources":["../../../resources/js/notifications/components/notification-list.tsx"],"sourcesContent":["import { Skeleton } from \"@lattice-php/lattice/ui/skeleton\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { NotificationItem } from \"@lattice-php/lattice/notifications/types\";\nimport type { NotificationsStatus } from \"@lattice-php/lattice/notifications/store\";\nimport { EmptyState } from \"./empty-state\";\nimport { NotificationItemRow } from \"./notification-item\";\n\nexport function NotificationList({\n notifications,\n status,\n hasMore,\n onMarkRead,\n onDismiss,\n onLoadMore,\n}: {\n notifications: NotificationItem[];\n status: NotificationsStatus;\n hasMore: boolean;\n onMarkRead: (id: string) => void;\n onDismiss: (id: string) => void;\n onLoadMore: () => void;\n}) {\n const { t } = useT(\"lattice\");\n\n if (status === \"loading\" && notifications.length === 0) {\n return (\n <div className=\"space-y-2 p-3\">\n <Skeleton className=\"h-12 w-full\" />\n <Skeleton className=\"h-12 w-full\" />\n <Skeleton className=\"h-12 w-full\" />\n </div>\n );\n }\n\n if (notifications.length === 0) {\n return <EmptyState />;\n }\n\n return (\n <div className=\"max-h-96 overflow-y-auto\">\n <ul className=\"divide-y divide-lt-border\">\n {notifications.map((notification) => (\n <NotificationItemRow\n key={notification.id}\n notification={notification}\n onMarkRead={onMarkRead}\n onDismiss={onDismiss}\n />\n ))}\n </ul>\n {hasMore ? (\n <button\n type=\"button\"\n className=\"w-full py-2 text-sm text-lt-muted-fg hover:text-lt-fg\"\n onClick={onLoadMore}\n >\n {t(\"notifications.load-more\", \"Load more\")}\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAOA,SAAgB,iBAAiB,EAC/B,eACA,QACA,SACA,YACA,WACA,cAQC;CACD,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,IAAI,WAAW,aAAa,cAAc,WAAW,GACnD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;GACnC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;GACnC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;EAChC;;CAIT,IAAI,cAAc,WAAW,GAC3B,OAAO,oBAAC,YAAD,CAAa,CAAA;CAGtB,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,cAAc,KAAK,iBAClB,oBAAC,qBAAD;IAEgB;IACF;IACD;GACZ,GAJM,aAAa,EAInB,CACF;EACC,CAAA,GACH,UACC,oBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,SAAS;GAER,UAAA,EAAE,2BAA2B,WAAW;EACnC,CAAA,IACN,IACD;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.js","names":[],"sources":["../../../resources/js/notifications/components/notifications.tsx"],"sourcesContent":["import { Component, lazy, Suspense, type ReactNode } from \"react\";\nimport { Dialog, DialogContent, DialogTitle } from \"@lattice-php/lattice/ui/dialog\";\nimport {\n Popover as PopoverRoot,\n PopoverContent,\n PopoverTrigger,\n} from \"@lattice-php/lattice/ui/popover\";\nimport { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useNotifications } from \"@lattice-php/lattice/notifications/store\";\nimport type { NotificationItem } from \"@lattice-php/lattice/notifications/types\";\nimport { NotificationList } from \"./notification-list\";\n\nconst NotificationsEcho = lazy(() =>\n import(\"./notifications-echo\").then((m) => ({ default: m.NotificationsEcho })),\n);\n\nclass EchoBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError(): { failed: boolean } {\n return { failed: true };\n }\n\n componentDidCatch(): void {\n console.warn(\n \"[lattice] The notifications bell declares a realtime channel but Echo is unavailable. Install @laravel/echo-react and call configureEcho().\",\n );\n }\n\n render(): ReactNode {\n return this.state.failed ? null : this.props.children;\n }\n}\n\nconst NotificationsComponent: RendererComponent<\"notifications\"> = ({ node }) => {\n const { t } = useT(\"lattice\");\n const store = useNotifications({\n endpoint: node.props.endpoint,\n pollingInterval: node.props.pollingInterval,\n });\n\n const label = t(\"notifications.label\", \"Notifications\");\n\n const trigger = (\n <span className=\"relative inline-flex items-center justify-center rounded-lt-sm p-2 hover:bg-lt-muted\">\n <Icon name=\"bell\" className=\"size-lt-icon-md\" />\n {store.unreadCount > 0 ? (\n <span\n data-test=\"notifications-badge\"\n className=\"absolute -right-0.5 -top-0.5 inline-flex min-w-4 items-center justify-center rounded-lt-full bg-lt-danger px-1 py-0 text-[10px] font-medium text-lt-danger-fg\"\n >\n {store.unreadCount}\n </span>\n ) : null}\n </span>\n );\n\n const panel = (\n <div className=\"w-80\" data-test=\"notifications-panel\">\n <div className=\"flex items-center justify-between border-b border-lt-border px-3 py-2\">\n <span className=\"text-sm font-medium\">{t(\"notifications.heading\", \"Notifications\")}</span>\n {store.unreadCount > 0 ? (\n <button\n type=\"button\"\n className=\"text-xs text-lt-muted-fg hover:text-lt-fg\"\n onClick={store.markAllRead}\n >\n {t(\"notifications.mark-all-read\", \"Mark all read\")}\n </button>\n ) : null}\n </div>\n <NotificationList\n notifications={store.notifications}\n status={store.status}\n hasMore={store.hasMore}\n onMarkRead={store.markRead}\n onDismiss={store.dismiss}\n onLoadMore={store.loadMore}\n />\n </div>\n );\n\n return (\n <>\n {node.props.channel ? (\n <EchoBoundary>\n <Suspense fallback={null}>\n <NotificationsEcho\n channel={node.props.channel}\n onReceive={(item: NotificationItem) => store.receive(item)}\n />\n </Suspense>\n </EchoBoundary>\n ) : null}\n\n {node.props.slideOut ? (\n <>\n <button\n type=\"button\"\n aria-label={label}\n data-test=\"notifications-trigger\"\n onClick={() => store.setOpen(true)}\n >\n {trigger}\n </button>\n <Dialog open={store.open} onOpenChange={store.setOpen}>\n <DialogContent aria-describedby={undefined} className=\"p-0\" placement=\"end\" width=\"sm\">\n <DialogTitle className=\"sr-only\">{label}</DialogTitle>\n {panel}\n </DialogContent>\n </Dialog>\n </>\n ) : (\n <PopoverRoot open={store.open} onOpenChange={store.setOpen}>\n <PopoverTrigger asChild>\n <button type=\"button\" aria-label={label} data-test=\"notifications-trigger\">\n {trigger}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"p-0\">\n {panel}\n </PopoverContent>\n </PopoverRoot>\n )}\n </>\n );\n};\n\nexport default NotificationsComponent;\n"],"mappings":";;;;;;;;;AAcA,IAAM,oBAAoB,WACxB,OAAO,2BAAwB,MAAM,OAAO,E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oBAAC,mBAAD;GACE,SAAS,KAAK,MAAM;GACpB,YAAY,SAA2B,MAAM,QAAQ,IAAI;EAC1D,CAAA;CACO,CAAA,EACE,CAAA,IACZ,MAEH,KAAK,MAAM,WACV,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EACE,MAAK;EACL,cAAY;EACZ,aAAU;EACV,eAAe,MAAM,QAAQ,IAAI;YAEhC;CACK,CAAA,GACR,oBAAC,QAAD;EAAQ,MAAM,MAAM;EAAM,cAAc,MAAM;YAC5C,qBAAC,eAAD;GAAe,oBAAkB,KAAA;GAAW,WAAU;GAAM,WAAU;GAAM,OAAM;aAAlF,CACE,oBAAC,aAAD;IAAa,WAAU;cAAW;GAAmB,CAAA,GACpD,KACY;;CACT,CAAA,CACR,EAAA,CAAA,IAEF,qBAAC,SAAD;EAAa,MAAM,MAAM;EAAM,cAAc,MAAM;YAAnD,CACE,oBAAC,gBAAD;GAAgB,SAAA;aACd,oBAAC,UAAD;IAAQ,MAAK;IAAS,cAAY;IAAO,aAAU;cAChD;GACK,CAAA;EACM,CAAA,GAChB,oBAAC,gBAAD;GAAgB,OAAM;GAAM,WAAU;aACnC;EACa,CAAA,CACL;GAEf,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"notifications.js","names":[],"sources":["../../../resources/js/notifications/components/notifications.tsx"],"sourcesContent":["import { Component, lazy, Suspense, type ReactNode } from \"react\";\nimport { Dialog, DialogContent, DialogTitle } from \"@lattice-php/lattice/ui/dialog\";\nimport {\n Popover as PopoverRoot,\n PopoverContent,\n PopoverTrigger,\n} from \"@lattice-php/lattice/ui/popover\";\nimport { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useNotifications } from \"@lattice-php/lattice/notifications/store\";\nimport type { NotificationItem } from \"@lattice-php/lattice/notifications/types\";\nimport { NotificationList } from \"./notification-list\";\n\nconst NotificationsEcho = lazy(() =>\n import(\"./notifications-echo\").then((m) => ({ default: m.NotificationsEcho })),\n);\n\nclass EchoBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError(): { failed: boolean } {\n return { failed: true };\n }\n\n componentDidCatch(): void {\n console.warn(\n \"[lattice] The notifications bell declares a realtime channel but Echo is unavailable. Install @laravel/echo-react and call configureEcho().\",\n );\n }\n\n render(): ReactNode {\n return this.state.failed ? null : this.props.children;\n }\n}\n\nconst NotificationsComponent: RendererComponent<\"notifications\"> = ({ node }) => {\n const { t } = useT(\"lattice\");\n const store = useNotifications({\n endpoint: node.props.endpoint,\n pollingInterval: node.props.pollingInterval,\n });\n\n const label = t(\"notifications.label\", \"Notifications\");\n\n const trigger = (\n <span className=\"relative inline-flex items-center justify-center rounded-lt-sm p-2 hover:bg-lt-muted\">\n <Icon name=\"bell\" className=\"size-lt-icon-md\" />\n {store.unreadCount > 0 ? (\n <span\n data-test=\"notifications-badge\"\n className=\"absolute -right-0.5 -top-0.5 inline-flex min-w-4 items-center justify-center rounded-lt-full bg-lt-danger px-1 py-0 text-[10px] font-medium text-lt-danger-fg\"\n >\n {store.unreadCount}\n </span>\n ) : null}\n </span>\n );\n\n const panel = (\n <div className=\"w-80\" data-test=\"notifications-panel\">\n <div className=\"flex items-center justify-between border-b border-lt-border px-3 py-2\">\n <span className=\"text-sm font-medium\">{t(\"notifications.heading\", \"Notifications\")}</span>\n {store.unreadCount > 0 ? (\n <button\n type=\"button\"\n className=\"text-xs text-lt-muted-fg hover:text-lt-fg\"\n onClick={store.markAllRead}\n >\n {t(\"notifications.mark-all-read\", \"Mark all read\")}\n </button>\n ) : null}\n </div>\n <NotificationList\n notifications={store.notifications}\n status={store.status}\n hasMore={store.hasMore}\n onMarkRead={store.markRead}\n onDismiss={store.dismiss}\n onLoadMore={store.loadMore}\n />\n </div>\n );\n\n return (\n <>\n {node.props.channel ? (\n <EchoBoundary>\n <Suspense fallback={null}>\n <NotificationsEcho\n channel={node.props.channel}\n onReceive={(item: NotificationItem) => store.receive(item)}\n />\n </Suspense>\n </EchoBoundary>\n ) : null}\n\n {node.props.slideOut ? (\n <>\n <button\n type=\"button\"\n aria-label={label}\n data-test=\"notifications-trigger\"\n onClick={() => store.setOpen(true)}\n >\n {trigger}\n </button>\n <Dialog open={store.open} onOpenChange={store.setOpen}>\n <DialogContent aria-describedby={undefined} className=\"p-0\" placement=\"end\" width=\"sm\">\n <DialogTitle className=\"sr-only\">{label}</DialogTitle>\n {panel}\n </DialogContent>\n </Dialog>\n </>\n ) : (\n <PopoverRoot open={store.open} onOpenChange={store.setOpen}>\n <PopoverTrigger asChild>\n <button type=\"button\" aria-label={label} data-test=\"notifications-trigger\">\n {trigger}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"p-0\">\n {panel}\n </PopoverContent>\n </PopoverRoot>\n )}\n </>\n );\n};\n\nexport default NotificationsComponent;\n"],"mappings":";;;;;;;;;AAcA,IAAM,oBAAoB,WACxB,OAAO,0BAAuB,CAAC,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAC/E;AAEA,IAAM,eAAN,cAA2B,UAAwD;CACjF,QAAQ,EAAE,QAAQ,MAAM;CAExB,OAAO,2BAAgD;EACrD,OAAO,EAAE,QAAQ,KAAK;CACxB;CAEA,oBAA0B;EACxB,QAAQ,KACN,6IACF;CACF;CAEA,SAAoB;EAClB,OAAO,KAAK,MAAM,SAAS,OAAO,KAAK,MAAM;CAC/C;AACF;AAEA,IAAM,0BAA8D,EAAE,WAAW;CAC/E,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,QAAQ,iBAAiB;EAC7B,UAAU,KAAK,MAAM;EACrB,iBAAiB,KAAK,MAAM;CAC9B,CAAC;CAED,MAAM,QAAQ,EAAE,uBAAuB,eAAe;CAEtD,MAAM,UACJ,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,oBAAC,MAAD;GAAM,MAAK;GAAO,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EF,qBAAC,SAAD;EAAa,MAAM,MAAM;EAAM,cAAc,MAAM;EAAnD,UAAA,CACE,oBAAC,gBAAD;GAAgB,SAAA;GACd,UAAA,oBAAC,UAAD;IAAQ,MAAK;IAAS,cAAY;IAAO,aAAU;IAChD,UAAA;GACK,CAAA;EACM,CAAA,GAChB,oBAAC,gBAAD;GAAgB,OAAM;GAAM,WAAU;GACnC,UAAA;EACa,CAAA,CACL;CAEf,CAAA,CAAA,EAAA,CAAA;AAEN"}
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","names":[],"sources":["../../resources/js/notifications/store.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n clearAll as apiClearAll,\n dismiss as apiDismiss,\n fetchNotifications,\n markAllRead as apiMarkAllRead,\n markRead as apiMarkRead,\n} from \"./api\";\nimport type { NotificationItem } from \"./types\";\n\nexport function prependIncoming(\n list: NotificationItem[],\n item: NotificationItem,\n): NotificationItem[] {\n if (list.some((n) => n.id === item.id)) {\n return list;\n }\n\n return [item, ...list];\n}\n\nexport function markReadIn(list: NotificationItem[], id: string): NotificationItem[] {\n return list.map((n) => (n.id === id ? { ...n, isRead: true } : n));\n}\n\nexport function removeIn(list: NotificationItem[], id: string): NotificationItem[] {\n return list.filter((n) => n.id !== id);\n}\n\nexport type NotificationsStatus = \"loading\" | \"idle\" | \"error\";\n\ntype UseNotificationsOptions = {\n endpoint: string;\n pollingInterval?: number | null;\n};\n\ntype UseNotificationsReturn = {\n notifications: NotificationItem[];\n unreadCount: number;\n status: NotificationsStatus;\n hasMore: boolean;\n open: boolean;\n setOpen: (open: boolean) => void;\n loadMore: () => void;\n markRead: (id: string) => void;\n markAllRead: () => void;\n dismiss: (id: string) => void;\n clearAll: () => void;\n receive: (item: NotificationItem) => void;\n};\n\nexport function useNotifications({\n endpoint,\n pollingInterval,\n}: UseNotificationsOptions): UseNotificationsReturn {\n const [notifications, setNotifications] = useState<NotificationItem[]>([]);\n const [unreadCount, setUnreadCount] = useState(0);\n const [status, setStatus] = useState<NotificationsStatus>(\"loading\");\n const [hasMore, setHasMore] = useState(false);\n const [open, setOpen] = useState(false);\n const pageRef = useRef(1);\n const hasMoreRef = useRef(hasMore);\n hasMoreRef.current = hasMore;\n const loadingMoreRef = useRef(false);\n\n const hydrate = useCallback(async (): Promise<void> => {\n try {\n const result = await fetchNotifications(endpoint, 1);\n pageRef.current = 1;\n setNotifications(result.notifications);\n setUnreadCount(result.unreadCount);\n setHasMore(result.hasMore);\n setStatus(\"idle\");\n } catch {\n setStatus(\"error\");\n }\n }, [endpoint]);\n\n useEffect(() => {\n void hydrate();\n }, [hydrate]);\n\n useEffect(() => {\n if (!pollingInterval || pollingInterval <= 0) {\n return;\n }\n\n const timer = setInterval(() => void hydrate(), pollingInterval * 1000);\n\n return () => clearInterval(timer);\n }, [hydrate, pollingInterval]);\n\n const loadMore = useCallback((): void => {\n if (loadingMoreRef.current || !hasMoreRef.current) {\n return;\n }\n\n loadingMoreRef.current = true;\n const next = pageRef.current + 1;\n void fetchNotifications(endpoint, next)\n .then((result) => {\n pageRef.current = next;\n setNotifications((current) => [...current, ...result.notifications]);\n setHasMore(result.hasMore);\n })\n .catch(() => void hydrate())\n .finally(() => {\n loadingMoreRef.current = false;\n });\n }, [endpoint, hydrate]);\n\n const markRead = useCallback(\n (id: string): void => {\n setNotifications((current) => markReadIn(current, id));\n setUnreadCount((count) => Math.max(0, count - 1));\n void apiMarkRead(endpoint, id)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n },\n [endpoint, hydrate],\n );\n\n const markAllRead = useCallback((): void => {\n setNotifications((current) => current.map((n) => ({ ...n, isRead: true })));\n setUnreadCount(0);\n void apiMarkAllRead(endpoint)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n }, [endpoint, hydrate]);\n\n const dismiss = useCallback(\n (id: string): void => {\n setNotifications((current) => removeIn(current, id));\n void apiDismiss(endpoint, id)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n },\n [endpoint, hydrate],\n );\n\n const clearAll = useCallback((): void => {\n setNotifications([]);\n setUnreadCount(0);\n void apiClearAll(endpoint)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n }, [endpoint, hydrate]);\n\n const receive = useCallback((item: NotificationItem): void => {\n setNotifications((current) => {\n const next = prependIncoming(current, item);\n if (next !== current) {\n setUnreadCount((count) => count + 1);\n }\n return next;\n });\n }, []);\n\n return {\n notifications,\n unreadCount,\n status,\n hasMore,\n open,\n setOpen,\n loadMore,\n markRead,\n markAllRead,\n dismiss,\n clearAll,\n receive,\n };\n}\n"],"mappings":";;;AAUA,SAAgB,gBACd,MACA,MACoB;CACpB,IAAI,KAAK,MAAM,MAAM,EAAE,OAAO,KAAK,EAAE,GACnC,OAAO;CAGT,OAAO,CAAC,MAAM,GAAG,IAAI;AACvB;AAEA,SAAgB,WAAW,MAA0B,IAAgC;CACnF,OAAO,KAAK,KAAK,MAAO,EAAE,OAAO,KAAK;EAAE,GAAG;EAAG,QAAQ;CAAK,IAAI,CAAE;AACnE;AAEA,SAAgB,SAAS,MAA0B,IAAgC;CACjF,OAAO,KAAK,QAAQ,MAAM,EAAE,OAAO,EAAE;AACvC;AAwBA,SAAgB,iBAAiB,EAC/B,UACA,mBACkD;CAClD,MAAM,CAAC,eAAe,oBAAoB,SAA6B,CAAC,CAAC;CACzE,MAAM,CAAC,aAAa,kBAAkB,SAAS,CAAC;CAChD,MAAM,CAAC,QAAQ,aAAa,SAA8B,SAAS;CACnE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,UAAU,OAAO,CAAC;CACxB,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,iBAAiB,OAAO,KAAK;CAEnC,MAAM,UAAU,YAAY,YAA2B;EACrD,IAAI;GACF,MAAM,SAAS,MAAM,mBAAmB,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AAe,CAAC;GAChB,YAAoB,QAAQ,EACzB,MAAM,MAAM,eAAe,EAAE,WAAW,CAAC,EACzC,YAAY,KAAK,QAAQ,CAAC;EAC/B,GAAG,CAAC,UAAU,OAAO,CAuCnB;EACA,SAtCc,aACb,OAAqB;GACpB,kBAAkB,YAAY,SAAS,SAAS,EAAE,CAAC;GACnD,QAAgB,UAAU,EAAE,EACzB,MAAM,MAAM,eAAe,EAAE,WAAW,CAAC,EACzC,YAAY,KAAK,QAAQ,CAAC;EAC/B,GACA,CAAC,UAAU,OAAO,CA+BlB;EACA,UA7Be,kBAAwB;GACvC,iBAAiB,CAAC,CAAC;GACnB,eAAe,CAAC;GAChB,SAAiB,QAAQ,EACtB,MAAM,MAAM,eAAe,EAAE,WAAW,CAAC,EACzC,YAAY,KAAK,QAAQ,CAAC;EAC/B,GAAG,CAAC,UAAU,OAAO,CAuBnB;EACA,SAtBc,aAAa,SAAiC;GAC5D,kBAAkB,YAAY;IAC5B,MAAM,OAAO,gBAAgB,SAAS,IAAI;IAC1C,IAAI,SAAS,SACX,gBAAgB,UAAU,QAAQ,CAAC;IAErC,OAAO;GACT,CAAC;EACH,GAAG,CAAC,CAcF;CACF;AACF"}
1
+ {"version":3,"file":"store.js","names":[],"sources":["../../resources/js/notifications/store.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n clearAll as apiClearAll,\n dismiss as apiDismiss,\n fetchNotifications,\n markAllRead as apiMarkAllRead,\n markRead as apiMarkRead,\n} from \"./api\";\nimport type { NotificationItem } from \"./types\";\n\nexport function prependIncoming(\n list: NotificationItem[],\n item: NotificationItem,\n): NotificationItem[] {\n if (list.some((n) => n.id === item.id)) {\n return list;\n }\n\n return [item, ...list];\n}\n\nexport function markReadIn(list: NotificationItem[], id: string): NotificationItem[] {\n return list.map((n) => (n.id === id ? { ...n, isRead: true } : n));\n}\n\nexport function removeIn(list: NotificationItem[], id: string): NotificationItem[] {\n return list.filter((n) => n.id !== id);\n}\n\nexport type NotificationsStatus = \"loading\" | \"idle\" | \"error\";\n\ntype UseNotificationsOptions = {\n endpoint: string;\n pollingInterval?: number | null;\n};\n\ntype UseNotificationsReturn = {\n notifications: NotificationItem[];\n unreadCount: number;\n status: NotificationsStatus;\n hasMore: boolean;\n open: boolean;\n setOpen: (open: boolean) => void;\n loadMore: () => void;\n markRead: (id: string) => void;\n markAllRead: () => void;\n dismiss: (id: string) => void;\n clearAll: () => void;\n receive: (item: NotificationItem) => void;\n};\n\nexport function useNotifications({\n endpoint,\n pollingInterval,\n}: UseNotificationsOptions): UseNotificationsReturn {\n const [notifications, setNotifications] = useState<NotificationItem[]>([]);\n const [unreadCount, setUnreadCount] = useState(0);\n const [status, setStatus] = useState<NotificationsStatus>(\"loading\");\n const [hasMore, setHasMore] = useState(false);\n const [open, setOpen] = useState(false);\n const pageRef = useRef(1);\n const hasMoreRef = useRef(hasMore);\n hasMoreRef.current = hasMore;\n const loadingMoreRef = useRef(false);\n\n const hydrate = useCallback(async (): Promise<void> => {\n try {\n const result = await fetchNotifications(endpoint, 1);\n pageRef.current = 1;\n setNotifications(result.notifications);\n setUnreadCount(result.unreadCount);\n setHasMore(result.hasMore);\n setStatus(\"idle\");\n } catch {\n setStatus(\"error\");\n }\n }, [endpoint]);\n\n useEffect(() => {\n void hydrate();\n }, [hydrate]);\n\n useEffect(() => {\n if (!pollingInterval || pollingInterval <= 0) {\n return;\n }\n\n const timer = setInterval(() => void hydrate(), pollingInterval * 1000);\n\n return () => clearInterval(timer);\n }, [hydrate, pollingInterval]);\n\n const loadMore = useCallback((): void => {\n if (loadingMoreRef.current || !hasMoreRef.current) {\n return;\n }\n\n loadingMoreRef.current = true;\n const next = pageRef.current + 1;\n void fetchNotifications(endpoint, next)\n .then((result) => {\n pageRef.current = next;\n setNotifications((current) => [...current, ...result.notifications]);\n setHasMore(result.hasMore);\n })\n .catch(() => void hydrate())\n .finally(() => {\n loadingMoreRef.current = false;\n });\n }, [endpoint, hydrate]);\n\n const markRead = useCallback(\n (id: string): void => {\n setNotifications((current) => markReadIn(current, id));\n setUnreadCount((count) => Math.max(0, count - 1));\n void apiMarkRead(endpoint, id)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n },\n [endpoint, hydrate],\n );\n\n const markAllRead = useCallback((): void => {\n setNotifications((current) => current.map((n) => ({ ...n, isRead: true })));\n setUnreadCount(0);\n void apiMarkAllRead(endpoint)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n }, [endpoint, hydrate]);\n\n const dismiss = useCallback(\n (id: string): void => {\n setNotifications((current) => removeIn(current, id));\n void apiDismiss(endpoint, id)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n },\n [endpoint, hydrate],\n );\n\n const clearAll = useCallback((): void => {\n setNotifications([]);\n setUnreadCount(0);\n void apiClearAll(endpoint)\n .then((r) => setUnreadCount(r.unreadCount))\n .catch(() => void hydrate());\n }, [endpoint, hydrate]);\n\n const receive = useCallback((item: NotificationItem): void => {\n setNotifications((current) => {\n const next = prependIncoming(current, item);\n if (next !== current) {\n setUnreadCount((count) => count + 1);\n }\n return next;\n });\n }, []);\n\n return {\n notifications,\n unreadCount,\n status,\n hasMore,\n open,\n setOpen,\n loadMore,\n markRead,\n markAllRead,\n dismiss,\n clearAll,\n receive,\n };\n}\n"],"mappings":";;;AAUA,SAAgB,gBACd,MACA,MACoB;CACpB,IAAI,KAAK,MAAM,MAAM,EAAE,OAAO,KAAK,EAAE,GACnC,OAAO;CAGT,OAAO,CAAC,MAAM,GAAG,IAAI;AACvB;AAEA,SAAgB,WAAW,MAA0B,IAAgC;CACnF,OAAO,KAAK,KAAK,MAAO,EAAE,OAAO,KAAK;EAAE,GAAG;EAAG,QAAQ;CAAK,IAAI,CAAE;AACnE;AAEA,SAAgB,SAAS,MAA0B,IAAgC;CACjF,OAAO,KAAK,QAAQ,MAAM,EAAE,OAAO,EAAE;AACvC;AAwBA,SAAgB,iBAAiB,EAC/B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CACF;AACF"}
package/dist/page.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","names":[],"sources":["../resources/js/page.tsx"],"sourcesContent":["import { Head } from \"@inertiajs/react\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport type { PagePayload } from \"@lattice-php/lattice\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { RealtimeListeners } from \"@lattice-php/lattice/realtime/listeners\";\n\ntype Props = {\n lattice: PagePayload;\n};\n\nexport default function Page({ lattice }: Props) {\n const content = <Renderer nodes={lattice.schema} />;\n\n return (\n <>\n <Head title={lattice.title ?? undefined} />\n\n <RealtimeListeners listeners={lattice.listeners} />\n\n {lattice.container === \"centered\" ? (\n <main className=\"min-h-svh bg-lt-bg text-lt-fg\">\n <div\n data-test=\"lattice-centered-container\"\n className=\"mx-auto flex min-h-svh w-full max-w-6xl flex-col justify-center px-6 py-12 sm:px-8 lg:px-10\"\n >\n {content}\n </div>\n </main>\n ) : (\n <div\n data-test=\"lattice-default-container\"\n className={cn(\"w-full\", {\n \"px-4 py-6\": lattice.layout !== null,\n })}\n >\n {content}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AAUA,SAAwB,KAAK,EAAE,WAAkB;CAC/C,MAAM,UAAU,oBAAC,UAAD,EAAU,OAAO,QAAQ,OAAS,CAAA;CAElD,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,MAAD,EAAM,OAAO,QAAQ,SAAS,KAAA,EAAY,CAAA;EAE1C,oBAAC,mBAAD,EAAmB,WAAW,QAAQ,UAAY,CAAA;EAEjD,QAAQ,cAAc,aACrB,oBAAC,QAAD;GAAM,WAAU;aACd,oBAAC,OAAD;IACE,aAAU;IACV,WAAU;cAET;GACE,CAAA;EACD,CAAA,IAEN,oBAAC,OAAD;GACE,aAAU;GACV,WAAW,GAAG,UAAU,EACtB,aAAa,QAAQ,WAAW,KAClC,CAAC;aAEA;EACE,CAAA;CAEP,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"page.js","names":[],"sources":["../resources/js/page.tsx"],"sourcesContent":["import { Head } from \"@inertiajs/react\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport type { PagePayload } from \"@lattice-php/lattice\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { RealtimeListeners } from \"@lattice-php/lattice/realtime/listeners\";\n\ntype Props = {\n lattice: PagePayload;\n};\n\nexport default function Page({ lattice }: Props) {\n const content = <Renderer nodes={lattice.schema} />;\n\n return (\n <>\n <Head title={lattice.title ?? undefined} />\n\n <RealtimeListeners listeners={lattice.listeners} />\n\n {lattice.container === \"centered\" ? (\n <main className=\"min-h-svh bg-lt-bg text-lt-fg\">\n <div\n data-test=\"lattice-centered-container\"\n className=\"mx-auto flex min-h-svh w-full max-w-6xl flex-col justify-center px-6 py-12 sm:px-8 lg:px-10\"\n >\n {content}\n </div>\n </main>\n ) : (\n <div\n data-test=\"lattice-default-container\"\n className={cn(\"w-full\", {\n \"px-4 py-6\": lattice.layout !== null,\n })}\n >\n {content}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AAUA,SAAwB,KAAK,EAAE,WAAkB;CAC/C,MAAM,UAAU,oBAAC,UAAD,EAAU,OAAO,QAAQ,OAAS,CAAA;CAElD,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,MAAD,EAAM,OAAO,QAAQ,SAAS,KAAA,EAAY,CAAA;EAE1C,oBAAC,mBAAD,EAAmB,WAAW,QAAQ,UAAY,CAAA;EAEjD,QAAQ,cAAc,aACrB,oBAAC,QAAD;GAAM,WAAU;GACd,UAAA,oBAAC,OAAD;IACE,aAAU;IACV,WAAU;IAET,UAAA;GACE,CAAA;EACD,CAAA,IAEN,oBAAC,OAAD;GACE,aAAU;GACV,WAAW,GAAG,UAAU,EACtB,aAAa,QAAQ,WAAW,KAClC,CAAC;GAEA,UAAA;EACE,CAAA;CAEP,EAAA,CAAA;AAEN"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider-base.js","names":[],"sources":["../resources/js/provider-base.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { ActionInteractionProvider } from \"./action/components/action-trigger-provider\";\nimport type { Registry } from \"./core/registry\";\nimport { RegistryContext } from \"./core/registry-context\";\nimport { useFlashEffects } from \"./effects/use-flash-effects\";\nimport { EventBridge } from \"./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 <ActionInteractionProvider>\n <SpriteProvider sprite={sprite}>\n {children}\n <EventBridge onAppearanceChange={updateAppearance} />\n {toaster ? <Toaster /> : null}\n </SpriteProvider>\n </ActionInteractionProvider>\n </RegistryContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,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,oBAAC,2BAAD,EAAA,UACE,qBAAC,gBAAD;GAAwB;aAAxB;IACG;IACD,oBAAC,aAAD,EAAa,oBAAoB,iBAAmB,CAAA;IACnD,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI;GACX;KACS,CAAA;CACH,CAAA;AAE9B"}
1
+ {"version":3,"file":"provider-base.js","names":[],"sources":["../resources/js/provider-base.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { ActionInteractionProvider } from \"./action/components/action-trigger-provider\";\nimport type { Registry } from \"./core/registry\";\nimport { RegistryContext } from \"./core/registry-context\";\nimport { useFlashEffects } from \"./effects/use-flash-effects\";\nimport { EventBridge } from \"./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 <ActionInteractionProvider>\n <SpriteProvider sprite={sprite}>\n {children}\n <EventBridge onAppearanceChange={updateAppearance} />\n {toaster ? <Toaster /> : null}\n </SpriteProvider>\n </ActionInteractionProvider>\n </RegistryContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,IAAM,gBAA6B,EAAE,MAAM,GAAG;AAS9C,SAAgB,aAAa,EAC3B,UACA,UACA,SAAS,eACT,UAAU,QACU;CACpB,gBAAgB;CAEhB,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;EAC/B,UAAA,oBAAC,2BAAD,EAAA,UACE,qBAAC,gBAAD;GAAwB;GAAxB,UAAA;IACG;IACD,oBAAC,aAAD,EAAa,oBAAoB,iBAAmB,CAAA;IACnD,UAAU,oBAAC,SAAD,CAAU,CAAA,IAAI;GACX;EACS,CAAA,EAAA,CAAA;CACH,CAAA;AAE9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"listeners.js","names":[],"sources":["../../resources/js/realtime/listeners.tsx"],"sourcesContent":["import { Component, lazy, Suspense } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { Listen } from \"@lattice-php/lattice/types/generated\";\n\nconst Subscriptions = lazy(() => import(\"./subscriptions\"));\n\nclass EchoBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError(): { failed: boolean } {\n return { failed: true };\n }\n\n componentDidCatch(): void {\n console.warn(\n \"[lattice] Real-time listeners are declared but Echo is unavailable. Install @laravel/echo-react and call configureEcho().\",\n );\n }\n\n render(): ReactNode {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/**\n * Renders nothing when a page declares no listeners, so the echo-react chunk\n * is only fetched where it is actually needed.\n */\nexport function RealtimeListeners({ listeners }: { listeners: Listen[] }) {\n if (listeners.length === 0) {\n return null;\n }\n\n return (\n <EchoBoundary>\n <Suspense fallback={null}>\n <Subscriptions listeners={listeners} />\n </Suspense>\n </EchoBoundary>\n );\n}\n"],"mappings":";;;AAIA,IAAM,gBAAgB,WAAW,OAAO,qBAAkB;AAE1D,IAAM,eAAN,cAA2B,UAAwD;CACjF,QAAQ,EAAE,QAAQ,MAAM;CAExB,OAAO,2BAAgD;EACrD,OAAO,EAAE,QAAQ,KAAK;CACxB;CAEA,oBAA0B;EACxB,QAAQ,KACN,2HACF;CACF;CAEA,SAAoB;EAClB,OAAO,KAAK,MAAM,SAAS,OAAO,KAAK,MAAM;CAC/C;AACF;;;;;AAMA,SAAgB,kBAAkB,EAAE,aAAsC;CACxE,IAAI,UAAU,WAAW,GACvB,OAAO;CAGT,OACE,oBAAC,cAAD,EAAA,UACE,oBAAC,UAAD;EAAU,UAAU;YAClB,oBAAC,eAAD,EAA0B,UAAY,CAAA;CAC9B,CAAA,EACE,CAAA;AAElB"}
1
+ {"version":3,"file":"listeners.js","names":[],"sources":["../../resources/js/realtime/listeners.tsx"],"sourcesContent":["import { Component, lazy, Suspense } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { Listen } from \"@lattice-php/lattice/types/generated\";\n\nconst Subscriptions = lazy(() => import(\"./subscriptions\"));\n\nclass EchoBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError(): { failed: boolean } {\n return { failed: true };\n }\n\n componentDidCatch(): void {\n console.warn(\n \"[lattice] Real-time listeners are declared but Echo is unavailable. Install @laravel/echo-react and call configureEcho().\",\n );\n }\n\n render(): ReactNode {\n return this.state.failed ? null : this.props.children;\n }\n}\n\n/**\n * Renders nothing when a page declares no listeners, so the echo-react chunk\n * is only fetched where it is actually needed.\n */\nexport function RealtimeListeners({ listeners }: { listeners: Listen[] }) {\n if (listeners.length === 0) {\n return null;\n }\n\n return (\n <EchoBoundary>\n <Suspense fallback={null}>\n <Subscriptions listeners={listeners} />\n </Suspense>\n </EchoBoundary>\n );\n}\n"],"mappings":";;;AAIA,IAAM,gBAAgB,WAAW,OAAO,qBAAkB;AAE1D,IAAM,eAAN,cAA2B,UAAwD;CACjF,QAAQ,EAAE,QAAQ,MAAM;CAExB,OAAO,2BAAgD;EACrD,OAAO,EAAE,QAAQ,KAAK;CACxB;CAEA,oBAA0B;EACxB,QAAQ,KACN,2HACF;CACF;CAEA,SAAoB;EAClB,OAAO,KAAK,MAAM,SAAS,OAAO,KAAK,MAAM;CAC/C;AACF;;;;;AAMA,SAAgB,kBAAkB,EAAE,aAAsC;CACxE,IAAI,UAAU,WAAW,GACvB,OAAO;CAGT,OACE,oBAAC,cAAD,EAAA,UACE,oBAAC,UAAD;EAAU,UAAU;EAClB,UAAA,oBAAC,eAAD,EAA0B,UAAY,CAAA;CAC9B,CAAA,EACE,CAAA;AAElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-list.js","names":[],"sources":["../../../resources/js/remote/components/data-list.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport type { RendererComponent, Schema } from \"@lattice-php/lattice/core/types\";\nimport { remoteJson } from \"@lattice-php/lattice/core/api\";\nimport { materializeSchema, type RemoteRow } from \"@lattice-php/lattice/core/materialize\";\nimport type { DataList as DataListProps } from \"@lattice-php/lattice/types/generated\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype RemotePayload = {\n data?: Array<Record<string, unknown>>;\n};\n\ntype RemoteDataListProps = DataListProps & {\n schema?: Schema;\n};\n\nfunction label(value: unknown): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n\n return String(value);\n}\n\nexport function RemoteDataList({ props }: { props: RemoteDataListProps }) {\n const { t } = useT(\"lattice\");\n const [rows, setRows] = useState<RemoteRow[]>([]);\n const [error, setError] = useState<string | null>(null);\n const [loading, setLoading] = useState(false);\n\n useEffect(() => {\n if (!props.remote || !props.dataEndpoint) {\n setRows([]);\n setLoading(false);\n\n return;\n }\n\n let cancelled = false;\n setError(null);\n setLoading(true);\n\n void remoteJson<RemotePayload>(props.dataEndpoint, { remote: props.remote })\n .then((payload) => {\n if (!cancelled) {\n setRows(payload.data ?? []);\n }\n })\n .catch((caught: unknown) => {\n if (!cancelled) {\n setError(caught instanceof Error ? caught.message : String(caught));\n }\n })\n .finally(() => {\n if (!cancelled) {\n setLoading(false);\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [props.dataEndpoint, props.remote]);\n\n if (error) {\n return <div className=\"rounded-lt border border-lt-danger/40 p-3 text-sm\">{error}</div>;\n }\n\n if (loading || !props.remote) {\n return (\n <div className=\"rounded-lt border border-lt-border p-3 text-sm\">\n {t(\"common.remote.data-list.loading\", \"Loading...\")}\n </div>\n );\n }\n\n return (\n <div className=\"rounded-lt border border-lt-border bg-lt-bg\">\n <div className=\"border-b border-lt-border px-3 py-2 text-sm font-medium\">\n {t(\"common.remote.data-list.title\", \"Remote data\")}\n </div>\n <div className=\"divide-y divide-lt-border\">\n {rows.map((row, index) => {\n return (\n <div className=\"px-3 py-2\" key={label(row.id) || index}>\n <Renderer nodes={materializeSchema(props.schema, row)} />\n </div>\n );\n })}\n {rows.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-lt-muted-fg\">\n {props.emptyLabel ?? t(\"common.remote.data-list.empty\", \"No data\")}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport const DataList: RendererComponent<\"remote.data-list\"> = ({ node })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,qBAAC,OAAD;GAAK,WAAU;aAAf,CACG,KAAK,KAAK,KAAK,UAAU;IACxB,OACE,oBAAC,OAAD;KAAK,WAAU;eACb,oBAAC,UAAD,EAAU,OAAO,kBAAkB,MAAM,QAAQ,GAAG,EAAI,CAAA;IACrD,GAF2B,MAAM,IAAI,EAAE,KAAK,KAE5C;GAET,CAAC,GACA,KAAK,WAAW,IACf,oBAAC,OAAD;IAAK,WAAU;cACZ,MAAM,cAAc,EAAE,iCAAiC,SAAS;GAC9D,CAAA,IACH,IACD;IACF;;AAET;AAEA,IAAa,YAAmD,EAAE,WAAW;CAC3E,OAAO,oBAAC,gBAAD,EAAgB,OAAO;EAAE,GAAG,KAAK;EAAO,QAAQ,KAAK;CAAO,EAAI,CAAA;AACzE"}
1
+ {"version":3,"file":"data-list.js","names":[],"sources":["../../../resources/js/remote/components/data-list.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport type { RendererComponent, Schema } from \"@lattice-php/lattice/core/types\";\nimport { remoteJson } from \"@lattice-php/lattice/core/api\";\nimport { materializeSchema, type RemoteRow } from \"@lattice-php/lattice/core/materialize\";\nimport type { DataList as DataListProps } from \"@lattice-php/lattice/types/generated\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\n\ntype RemotePayload = {\n data?: Array<Record<string, unknown>>;\n};\n\ntype RemoteDataListProps = DataListProps & {\n schema?: Schema;\n};\n\nfunction label(value: unknown): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n\n return String(value);\n}\n\nexport function RemoteDataList({ props }: { props: RemoteDataListProps }) {\n const { t } = useT(\"lattice\");\n const [rows, setRows] = useState<RemoteRow[]>([]);\n const [error, setError] = useState<string | null>(null);\n const [loading, setLoading] = useState(false);\n\n useEffect(() => {\n if (!props.remote || !props.dataEndpoint) {\n setRows([]);\n setLoading(false);\n\n return;\n }\n\n let cancelled = false;\n setError(null);\n setLoading(true);\n\n void remoteJson<RemotePayload>(props.dataEndpoint, { remote: props.remote })\n .then((payload) => {\n if (!cancelled) {\n setRows(payload.data ?? []);\n }\n })\n .catch((caught: unknown) => {\n if (!cancelled) {\n setError(caught instanceof Error ? caught.message : String(caught));\n }\n })\n .finally(() => {\n if (!cancelled) {\n setLoading(false);\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [props.dataEndpoint, props.remote]);\n\n if (error) {\n return <div className=\"rounded-lt border border-lt-danger/40 p-3 text-sm\">{error}</div>;\n }\n\n if (loading || !props.remote) {\n return (\n <div className=\"rounded-lt border border-lt-border p-3 text-sm\">\n {t(\"common.remote.data-list.loading\", \"Loading...\")}\n </div>\n );\n }\n\n return (\n <div className=\"rounded-lt border border-lt-border bg-lt-bg\">\n <div className=\"border-b border-lt-border px-3 py-2 text-sm font-medium\">\n {t(\"common.remote.data-list.title\", \"Remote data\")}\n </div>\n <div className=\"divide-y divide-lt-border\">\n {rows.map((row, index) => {\n return (\n <div className=\"px-3 py-2\" key={label(row.id) || index}>\n <Renderer nodes={materializeSchema(props.schema, row)} />\n </div>\n );\n })}\n {rows.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-lt-muted-fg\">\n {props.emptyLabel ?? t(\"common.remote.data-list.empty\", \"No data\")}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport const DataList: RendererComponent<\"remote.data-list\"> = ({ node }) => {\n return <RemoteDataList props={{ ...node.props, schema: node.schema }} />;\n};\n\nexport default DataList;\n"],"mappings":";;;;;;;AAgBA,SAAS,MAAM,OAAwB;CACrC,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B,OAAO;CAGT,OAAO,OAAO,KAAK;AACrB;AAEA,SAAgB,eAAe,EAAE,SAAyC;CACxE,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,CAAC,MAAM,WAAW,SAAsB,CAAC,CAAC;CAChD,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CA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EACF,CAAA,CAAA;;AAET;AAEA,IAAa,YAAmD,EAAE,WAAW;CAC3E,OAAO,oBAAC,gBAAD,EAAgB,OAAO;EAAE,GAAG,KAAK;EAAO,QAAQ,KAAK;CAAO,EAAI,CAAA;AACzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"bulk-bar.js","names":[],"sources":["../../../resources/js/table/components/bulk-bar.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { ActionForm, runAction } from \"@lattice-php/lattice/action\";\nimport { apiFetch } from \"@lattice-php/lattice/core/api\";\nimport { useEffectDispatcher } from \"@lattice-php/lattice/effects/use-effect-dispatcher\";\nimport { Button } from \"@lattice-php/lattice/ui/button\";\nimport { ConfirmDialog } from \"@lattice-php/lattice/ui/confirm-dialog\";\nimport { Spinner } from \"@lattice-php/lattice/ui/spinner\";\nimport { prefixedTestId } from \"@lattice-php/lattice/core/test-id\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { BulkAction } from \"@lattice-php/lattice/table/lib/bulk\";\n\nexport function BulkBar({\n actions,\n selectedKeys,\n allMatching,\n total,\n query,\n canSelectAllMatching,\n onSelectAllMatching,\n onCompleted,\n}: {\n actions: BulkAction[];\n selectedKeys: string[];\n allMatching: boolean;\n total?: number;\n query: Record<string, unknown>;\n canSelectAllMatching: boolean;\n onSelectAllMatching: () => void;\n onCompleted: () => void;\n}) {\n const { t } = useT(\"lattice\");\n const [processing, setProcessing] = useState(false);\n const dispatch = useEffectDispatcher();\n const [confirming, setConfirming] = useState<BulkAction | null>(null);\n const [filling, setFilling] = useState<BulkAction | null>(null);\n\n const selectionPayload = (): Record<string, unknown> =>\n allMatching ? { allMatching: true, ...query } : { selected: selectedKeys };\n\n async function submit(action: BulkAction): Promise<void> {\n setProcessing(true);\n\n const ok = await runAction(\n () =>\n apiFetch(action.endpoint, {\n method: action.method,\n ref: action.ref,\n body: JSON.stringify(selectionPayload()),\n throwOnError: false,\n }),\n dispatch,\n );\n\n setProcessing(false);\n\n if (ok) {\n setConfirming(null);\n onCompleted();\n }\n }\n\n function run(action: BulkAction): void {\n if (action.form) {\n setFilling(action);\n\n return;\n }\n\n if (action.confirmation) {\n setConfirming(action);\n\n return;\n }\n\n void submit(action);\n }\n\n const count = allMatching ? (total ?? selectedKeys.length) : selectedKeys.length;\n\n return (\n <div className=\"flex flex-wrap items-center gap-3 border-b border-lt-border bg-lt-muted/50 p-4 text-sm\">\n <span className=\"font-medium\">\n {allMatching\n ? t(\"table.bulk.all-selected\", \"All {{count}} selected\", { count })\n : t(\"table.bulk.selected\", \"{{count}} selected\", { count })}\n </span>\n {canSelectAllMatching && (\n <button\n type=\"button\"\n data-test=\"bulk-select-all-matching\"\n className=\"font-medium text-lt-primary underline underline-offset-2\"\n onClick={onSelectAllMatching}\n >\n {t(\"table.bulk.select-all-matching\", \"Select all {{total}} matching\", { total })}\n </button>\n )}\n <div className=\"flex flex-wrap items-center gap-2\">\n {actions.map((action) => (\n <Button\n key={action.id}\n type=\"button\"\n data-test={prefixedTestId(\"bulk-action\", action.id)}\n variant={action.variant}\n emphasis={action.emphasis}\n disabled={processing}\n onClick={() => run(action)}\n >\n {processing && <Spinner />}\n {action.label}\n </Button>\n ))}\n </div>\n\n {confirming?.confirmation && (\n <ConfirmDialog\n title={confirming.confirmation.title ?? confirming.label}\n description={confirming.confirmation.description ?? undefined}\n confirmLabel={confirming.confirmation.confirmLabel ?? confirming.label}\n cancelLabel={confirming.confirmation.cancelLabel ?? t(\"common.cancel\", \"Cancel\")}\n confirmVariant={confirming.variant}\n confirmEmphasis={confirming.emphasis}\n processing={processing}\n onConfirm={() => void submit(confirming)}\n onCancel={() => setConfirming(null)}\n />\n )}\n\n {filling?.form && (\n <ActionForm\n cancelLabel={filling.confirmation?.cancelLabel ?? t(\"common.cancel\", \"Cancel\")}\n componentRef={filling.ref}\n description={filling.confirmation?.description ?? undefined}\n endpoint={filling.endpoint}\n extraData={selectionPayload()}\n formNode={filling.form}\n method={filling.method}\n onClose={() => setFilling(null)}\n onSuccess={() => {\n setFilling(null);\n onCompleted();\n }}\n placement={filling.modalSide ?? \"center\"}\n submitLabel={filling.confirmation?.confirmLabel ?? filling.label}\n title={filling.confirmation?.title ?? filling.label}\n width={filling.modalWidth ?? undefined}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,QAAQ,EACtB,SACA,cACA,aACA,OACA,OACA,sBACA,qBACA,eAUC;CACD,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,WAAW,oBAAoB;CACrC,MAAM,CAAC,YAAY,iBAAiB,SAA4B,IAAI;CACpE,MAAM,CAAC,SAAS,cAAc,SAA4B,IAAI;CAE9D,MAAM,yBACJ,cAAc;EAAE,aAAa;EAAM,GAAG;CAAM,IAAI,EAAE,UAAU,aAAa;CAE3E,eAAe,OAAO,QAAmC;EACvD,cAAc,IAAI;EAElB,MAAM,KAAK,MAAM,gBAEb,SAAS,OAAO,UAAU;GACxB,QAAQ,OAAO;GACf,KAAK,OAAO;GACZ,MAAM,KAAK,UAAU,iBAAiB,CAAC;GACvC,cAAc;EAChB,CAAC,GACH,QACF;EAEA,cAAc,KAAK;EAEnB,IAAI,IAAI;GACN,cAAc,IAAI;GAClB,YAAY;EACd;CACF;CAEA,SAAS,IAAI,QAA0B;EACrC,IAAI,OAAO,MAAM;GACf,WAAW,MAAM;GAEjB;EACF;EAEA,IAAI,OAAO,cAAc;GACvB,cAAc,MAAM;GAEpB;EACF;EAEA,OAAY,MAAM;CACpB;CAEA,MAAM,QAAQ,cAAe,SAAS,aAAa,SAAU,aAAa;CAE1E,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,oBAAC,QAAD;IAAM,WAAU;cACb,cACG,EAAE,2BAA2B,0BAA0B,EAAE,MAAM,CAAC,IAChE,EAAE,uBAAuB,sBAAsB,EAAE,MAAM,CAAC;GACxD,CAAA;GACL,wBACC,oBAAC,UAAD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["import { useState } from \"react\";\nimport { ActionForm, runAction } from \"@lattice-php/lattice/action\";\nimport { apiFetch } from \"@lattice-php/lattice/core/api\";\nimport { useEffectDispatcher } from \"@lattice-php/lattice/effects/use-effect-dispatcher\";\nimport { Button } from \"@lattice-php/lattice/ui/button\";\nimport { ConfirmDialog } from \"@lattice-php/lattice/ui/confirm-dialog\";\nimport { Spinner } from \"@lattice-php/lattice/ui/spinner\";\nimport { prefixedTestId } from \"@lattice-php/lattice/core/test-id\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { BulkAction } from \"@lattice-php/lattice/table/lib/bulk\";\n\nexport function BulkBar({\n actions,\n selectedKeys,\n allMatching,\n total,\n query,\n canSelectAllMatching,\n onSelectAllMatching,\n onCompleted,\n}: {\n actions: BulkAction[];\n selectedKeys: string[];\n allMatching: boolean;\n total?: number;\n query: Record<string, unknown>;\n canSelectAllMatching: boolean;\n onSelectAllMatching: () => void;\n onCompleted: () => void;\n}) {\n const { t } = useT(\"lattice\");\n const [processing, setProcessing] = useState(false);\n const dispatch = useEffectDispatcher();\n const [confirming, setConfirming] = useState<BulkAction | null>(null);\n const [filling, setFilling] = useState<BulkAction | null>(null);\n\n const selectionPayload = (): Record<string, unknown> =>\n allMatching ? { allMatching: true, ...query } : { selected: selectedKeys };\n\n async function submit(action: BulkAction): Promise<void> {\n setProcessing(true);\n\n const ok = await runAction(\n () =>\n apiFetch(action.endpoint, {\n method: action.method,\n ref: action.ref,\n body: JSON.stringify(selectionPayload()),\n throwOnError: false,\n }),\n dispatch,\n );\n\n setProcessing(false);\n\n if (ok) {\n setConfirming(null);\n onCompleted();\n }\n }\n\n function run(action: BulkAction): void {\n if (action.form) {\n setFilling(action);\n\n return;\n }\n\n if (action.confirmation) {\n setConfirming(action);\n\n return;\n }\n\n void submit(action);\n }\n\n const count = allMatching ? (total ?? selectedKeys.length) : selectedKeys.length;\n\n return (\n <div className=\"flex flex-wrap items-center gap-3 border-b border-lt-border bg-lt-muted/50 p-4 text-sm\">\n <span className=\"font-medium\">\n {allMatching\n ? t(\"table.bulk.all-selected\", \"All {{count}} selected\", { count })\n : t(\"table.bulk.selected\", \"{{count}} selected\", { count })}\n </span>\n {canSelectAllMatching && (\n <button\n type=\"button\"\n data-test=\"bulk-select-all-matching\"\n className=\"font-medium text-lt-primary underline underline-offset-2\"\n onClick={onSelectAllMatching}\n >\n {t(\"table.bulk.select-all-matching\", \"Select all {{total}} matching\", { total })}\n </button>\n )}\n <div className=\"flex flex-wrap items-center gap-2\">\n {actions.map((action) => (\n <Button\n key={action.id}\n type=\"button\"\n data-test={prefixedTestId(\"bulk-action\", action.id)}\n variant={action.variant}\n emphasis={action.emphasis}\n disabled={processing}\n onClick={() => run(action)}\n >\n {processing && <Spinner />}\n {action.label}\n </Button>\n ))}\n </div>\n\n {confirming?.confirmation && (\n <ConfirmDialog\n title={confirming.confirmation.title ?? confirming.label}\n description={confirming.confirmation.description ?? undefined}\n confirmLabel={confirming.confirmation.confirmLabel ?? confirming.label}\n cancelLabel={confirming.confirmation.cancelLabel ?? t(\"common.cancel\", \"Cancel\")}\n confirmVariant={confirming.variant}\n confirmEmphasis={confirming.emphasis}\n processing={processing}\n onConfirm={() => void submit(confirming)}\n onCancel={() => setConfirming(null)}\n />\n )}\n\n {filling?.form && (\n <ActionForm\n cancelLabel={filling.confirmation?.cancelLabel ?? t(\"common.cancel\", \"Cancel\")}\n componentRef={filling.ref}\n description={filling.confirmation?.description ?? undefined}\n endpoint={filling.endpoint}\n extraData={selectionPayload()}\n formNode={filling.form}\n method={filling.method}\n onClose={() => setFilling(null)}\n onSuccess={() => {\n setFilling(null);\n onCompleted();\n }}\n placement={filling.modalSide ?? \"center\"}\n submitLabel={filling.confirmation?.confirmLabel ?? filling.label}\n title={filling.confirmation?.title ?? filling.label}\n width={filling.modalWidth ?? undefined}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,QAAQ,EACtB,SACA,cACA,aACA,OACA,OACA,s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SAAS,OAAO;KAChB,UAAU,OAAO;KACjB,UAAU;KACV,eAAe,IAAI,MAAM;KAP3B,UAAA,CASG,cAAc,oBAAC,SAAD,CAAU,CAAA,GACxB,OAAO,KACF;IAVD,GAAA,OAAO,EAUN,CACT;GACE,CAAA;GAEJ,YAAY,gBACX,oBAAC,eAAD;IACE,OAAO,WAAW,aAAa,SAAS,WAAW;IACnD,aAAa,WAAW,aAAa,eAAe,KAAA;IACpD,cAAc,WAAW,aAAa,gBAAgB,WAAW;IACjE,aAAa,WAAW,aAAa,eAAe,EAAE,iBAAiB,QAAQ;IAC/E,gBAAgB,WAAW;IAC3B,iBAAiB,WAAW;IAChB;IACZ,iBAAiB,KAAK,OAAO,UAAU;IACvC,gBAAgB,cAAc,IAAI;GACnC,CAAA;GAGF,SAAS,QACR,oBAAC,YAAD;IACE,aAAa,QAAQ,cAAc,eAAe,EAAE,iBAAiB,QAAQ;IAC7E,cAAc,QAAQ;IACtB,aAAa,QAAQ,cAAc,eAAe,KAAA;IAClD,UAAU,QAAQ;IAClB,WAAW,iBAAiB;IAC5B,UAAU,QAAQ;IAClB,QAAQ,QAAQ;IAChB,eAAe,WAAW,IAAI;IAC9B,iBAAiB;KACf,WAAW,IAAI;KACf,YAAY;IACd;IACA,WAAW,QAAQ,aAAa;IAChC,aAAa,QAAQ,cAAc,gBAAgB,QAAQ;IAC3D,OAAO,QAAQ,cAAc,SAAS,QAAQ;IAC9C,OAAO,QAAQ,cAAc,KAAA;GAC9B,CAAA;EAEA;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"badge-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/badge-cell.tsx"],"sourcesContent":["import { Badge } from \"@lattice-php/lattice/ui/badge\";\nimport { formatCell } from \"@lattice-php/lattice/table/lib/format\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const BadgeCell: ColumnCellComponent<\"column.badge\"> = ({ column, props, value }) => {\n const label = formatCell(value, column);\n\n if (label === \"\") {\n return null;\n }\n\n return <Badge color={props.colors?.[String(value)]}>{label}</Badge>;\n};\n"],"mappings":";;;;AAIA,IAAa,aAAkD,EAAE,QAAQ,OAAO,YAAY;CAC1F,MAAM,QAAQ,WAAW,OAAO,MAAM;CAEtC,IAAI,UAAU,IACZ,OAAO;CAGT,OAAO,oBAAC,OAAD;EAAO,OAAO,MAAM,SAAS,OAAO,KAAK;YAAK;CAAa,CAAA;AACpE"}
1
+ {"version":3,"file":"badge-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/badge-cell.tsx"],"sourcesContent":["import { Badge } from \"@lattice-php/lattice/ui/badge\";\nimport { formatCell } from \"@lattice-php/lattice/table/lib/format\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const BadgeCell: ColumnCellComponent<\"column.badge\"> = ({ column, props, value }) => {\n const label = formatCell(value, column);\n\n if (label === \"\") {\n return null;\n }\n\n return <Badge color={props.colors?.[String(value)]}>{label}</Badge>;\n};\n"],"mappings":";;;;AAIA,IAAa,aAAkD,EAAE,QAAQ,OAAO,YAAY;CAC1F,MAAM,QAAQ,WAAW,OAAO,MAAM;CAEtC,IAAI,UAAU,IACZ,OAAO;CAGT,OAAO,oBAAC,OAAD;EAAO,OAAO,MAAM,SAAS,OAAO,KAAK;EAAK,UAAA;CAAa,CAAA;AACpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/boolean-cell.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { isTruthy } from \"@lattice-php/lattice/lib/is-truthy\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const BooleanCell: ColumnCellComponent<\"column.boolean\"> = ({ value }) => {\n const { t } = useT(\"lattice\");\n const truthy = isTruthy(value);\n\n return (\n <span aria-label={truthy ? t(\"common.yes\", \"Yes\") : t(\"common.no\", \"No\")} role=\"img\">\n <Icon\n name={truthy ? \"check\" : \"x\"}\n className={cn(\"size-lt-icon-md\", truthy ? \"text-lt-success\" : \"text-lt-muted-fg\")}\n />\n </span>\n );\n};\n"],"mappings":";;;;;;AAMA,IAAa,eAAsD,EAAE,YAAY;CAC/E,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,SAAS,SAAS,KAAK;CAE7B,OACE,oBAAC,QAAD;EAAM,cAAY,SAAS,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,IAAI;EAAG,MAAK;YAC7E,oBAAC,MAAD;GACE,MAAM,SAAS,UAAU;GACzB,WAAW,GAAG,mBAAmB,SAAS,oBAAoB,kBAAkB;EACjF,CAAA;CACG,CAAA;AAEV"}
1
+ {"version":3,"file":"boolean-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/boolean-cell.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { isTruthy } from \"@lattice-php/lattice/lib/is-truthy\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const BooleanCell: ColumnCellComponent<\"column.boolean\"> = ({ value }) => {\n const { t } = useT(\"lattice\");\n const truthy = isTruthy(value);\n\n return (\n <span aria-label={truthy ? t(\"common.yes\", \"Yes\") : t(\"common.no\", \"No\")} role=\"img\">\n <Icon\n name={truthy ? \"check\" : \"x\"}\n className={cn(\"size-lt-icon-md\", truthy ? \"text-lt-success\" : \"text-lt-muted-fg\")}\n />\n </span>\n );\n};\n"],"mappings":";;;;;;AAMA,IAAa,eAAsD,EAAE,YAAY;CAC/E,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,SAAS,SAAS,KAAK;CAE7B,OACE,oBAAC,QAAD;EAAM,cAAY,SAAS,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,IAAI;EAAG,MAAK;EAC7E,UAAA,oBAAC,MAAD;GACE,MAAM,SAAS,UAAU;GACzB,WAAW,GAAG,mBAAmB,SAAS,oBAAoB,kBAAkB;EACjF,CAAA;CACG,CAAA;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/icon-cell.tsx"],"sourcesContent":["import { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { coerceColor, toneProps } from \"@lattice-php/lattice/lib/color\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const IconCell: ColumnCellComponent<\"column.icon\"> = ({ props, value }) => {\n const icon = props.icons?.[String(value)] ?? props.icon ?? undefined;\n\n if (!icon) {\n return null;\n }\n\n const color = coerceColor(props.colors?.[String(value)]);\n const tone = color ? toneProps(color) : undefined;\n\n return (\n <span\n aria-label={String(value)}\n className={cn(\"lt-cell-icon\", tone?.className)}\n style={tone?.style}\n >\n <IconRenderer className=\"size-lt-icon-md\" icon={icon} />\n </span>\n );\n};\n"],"mappings":";;;;;AAKA,IAAa,YAAgD,EAAE,OAAO,YAAY;CAChF,MAAM,OAAO,MAAM,QAAQ,OAAO,KAAK,MAAM,MAAM,QAAQ,KAAA;CAE3D,IAAI,CAAC,MACH,OAAO;CAGT,MAAM,QAAQ,YAAY,MAAM,SAAS,OAAO,KAAK,EAAE;CACvD,MAAM,OAAO,QAAQ,UAAU,KAAK,IAAI,KAAA;CAExC,OACE,oBAAC,QAAD;EACE,cAAY,OAAO,KAAK;EACxB,WAAW,GAAG,gBAAgB,MAAM,SAAS;EAC7C,OAAO,MAAM;YAEb,oBAAC,cAAD;GAAc,WAAU;GAAwB;EAAO,CAAA;CACnD,CAAA;AAEV"}
1
+ {"version":3,"file":"icon-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/icon-cell.tsx"],"sourcesContent":["import { IconRenderer } from \"@lattice-php/lattice/icons\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { coerceColor, toneProps } from \"@lattice-php/lattice/lib/color\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const IconCell: ColumnCellComponent<\"column.icon\"> = ({ props, value }) => {\n const icon = props.icons?.[String(value)] ?? props.icon ?? undefined;\n\n if (!icon) {\n return null;\n }\n\n const color = coerceColor(props.colors?.[String(value)]);\n const tone = color ? toneProps(color) : undefined;\n\n return (\n <span\n aria-label={String(value)}\n className={cn(\"lt-cell-icon\", tone?.className)}\n style={tone?.style}\n >\n <IconRenderer className=\"size-lt-icon-md\" icon={icon} />\n </span>\n );\n};\n"],"mappings":";;;;;AAKA,IAAa,YAAgD,EAAE,OAAO,YAAY;CAChF,MAAM,OAAO,MAAM,QAAQ,OAAO,KAAK,MAAM,MAAM,QAAQ,KAAA;CAE3D,IAAI,CAAC,MACH,OAAO;CAGT,MAAM,QAAQ,YAAY,MAAM,SAAS,OAAO,KAAK,EAAE;CACvD,MAAM,OAAO,QAAQ,UAAU,KAAK,IAAI,KAAA;CAExC,OACE,oBAAC,QAAD;EACE,cAAY,OAAO,KAAK;EACxB,WAAW,GAAG,gBAAgB,MAAM,SAAS;EAC7C,OAAO,MAAM;EAEb,UAAA,oBAAC,cAAD;GAAc,WAAU;GAAwB;EAAO,CAAA;CACnD,CAAA;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"numeric-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/numeric-cell.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useLocale } from \"@lattice-php/lattice/i18n\";\nimport type { NumberFormat } from \"@lattice-php/lattice/types/generated\";\nimport { formatNumber } from \"@lattice-php/lattice/format/number\";\nimport { numericValue } from \"@lattice-php/lattice/format/numeric\";\nimport { formatCell } from \"@lattice-php/lattice/table/lib/format\";\nimport type { TableColumn } from \"@lattice-php/lattice/table/types\";\nimport { CopyableCell } from \"./copyable-cell\";\n\n/** Shared numeric cell body for the money and number columns. */\nexport function NumericCell({\n column,\n copyable,\n format,\n value,\n}: {\n column: TableColumn;\n copyable?: boolean | null;\n format: NumberFormat;\n value: unknown;\n}): ReactNode {\n const { locale } = useLocale();\n\n if (numericValue(value) === null) {\n return <span>{formatCell(value, column)}</span>;\n }\n\n return (\n <CopyableCell column={column} copyable={copyable} value={String(value)}>\n <span className=\"tabular-nums\">{formatNumber(value, format, locale)}</span>\n </CopyableCell>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,YAAY,EAC1B,QACA,UACA,QACA,SAMY;CACZ,MAAM,EAAE,WAAW,UAAU;CAE7B,IAAI,aAAa,KAAK,MAAM,MAC1B,OAAO,oBAAC,QAAD,EAAA,UAAO,WAAW,OAAO,MAAM,EAAQ,CAAA;CAGhD,OACE,oBAAC,cAAD;EAAsB;EAAkB;EAAU,OAAO,OAAO,KAAK;YACnE,oBAAC,QAAD;GAAM,WAAU;aAAgB,aAAa,OAAO,QAAQ,MAAM;EAAQ,CAAA;CAC9D,CAAA;AAElB"}
1
+ {"version":3,"file":"numeric-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/numeric-cell.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useLocale } from \"@lattice-php/lattice/i18n\";\nimport type { NumberFormat } from \"@lattice-php/lattice/types/generated\";\nimport { formatNumber } from \"@lattice-php/lattice/format/number\";\nimport { numericValue } from \"@lattice-php/lattice/format/numeric\";\nimport { formatCell } from \"@lattice-php/lattice/table/lib/format\";\nimport type { TableColumn } from \"@lattice-php/lattice/table/types\";\nimport { CopyableCell } from \"./copyable-cell\";\n\n/** Shared numeric cell body for the money and number columns. */\nexport function NumericCell({\n column,\n copyable,\n format,\n value,\n}: {\n column: TableColumn;\n copyable?: boolean | null;\n format: NumberFormat;\n value: unknown;\n}): ReactNode {\n const { locale } = useLocale();\n\n if (numericValue(value) === null) {\n return <span>{formatCell(value, column)}</span>;\n }\n\n return (\n <CopyableCell column={column} copyable={copyable} value={String(value)}>\n <span className=\"tabular-nums\">{formatNumber(value, format, locale)}</span>\n </CopyableCell>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,YAAY,EAC1B,QACA,UACA,QACA,SAMY;CACZ,MAAM,EAAE,WAAW,UAAU;CAE7B,IAAI,aAAa,KAAK,MAAM,MAC1B,OAAO,oBAAC,QAAD,EAAA,UAAO,WAAW,OAAO,MAAM,EAAQ,CAAA;CAGhD,OACE,oBAAC,cAAD;EAAsB;EAAkB;EAAU,OAAO,OAAO,KAAK;EACnE,UAAA,oBAAC,QAAD;GAAM,WAAU;GAAgB,UAAA,aAAa,OAAO,QAAQ,MAAM;EAAQ,CAAA;CAC9D,CAAA;AAElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"stack-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/stack-cell.tsx"],"sourcesContent":["import { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { materializeSchema } from \"@lattice-php/lattice/core/materialize\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const StackCell: ColumnCellComponent<\"column.stack\"> = ({ column, row }) => (\n <div className=\"grid gap-1\">\n <Renderer nodes={materializeSchema(column.schema, row)} />\n </div>\n);\n"],"mappings":";;;;AAIA,IAAa,aAAkD,EAAE,QAAQ,UACvE,oBAAC,OAAD;CAAK,WAAU;WACb,oBAAC,UAAD,EAAU,OAAO,kBAAkB,OAAO,QAAQ,GAAG,EAAI,CAAA;AACtD,CAAA"}
1
+ {"version":3,"file":"stack-cell.js","names":[],"sources":["../../../../resources/js/table/components/cells/stack-cell.tsx"],"sourcesContent":["import { Renderer } from \"@lattice-php/lattice/core/renderer\";\nimport { materializeSchema } from \"@lattice-php/lattice/core/materialize\";\nimport type { ColumnCellComponent } from \"@lattice-php/lattice/table/registry\";\n\nexport const StackCell: ColumnCellComponent<\"column.stack\"> = ({ column, row }) => (\n <div className=\"grid gap-1\">\n <Renderer nodes={materializeSchema(column.schema, row)} />\n </div>\n);\n"],"mappings":";;;;AAIA,IAAa,aAAkD,EAAE,QAAQ,UACvE,oBAAC,OAAD;CAAK,WAAU;CACb,UAAA,oBAAC,UAAD,EAAU,OAAO,kBAAkB,OAAO,QAAQ,GAAG,EAAI,CAAA;AACtD,CAAA"}