@lattice-php/lattice 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action/components/action-form.js +3 -3
- package/dist/action/components/action-form.js.map +1 -1
- package/dist/action/components/action-group.js +1 -1
- package/dist/action/components/action-group.js.map +1 -1
- package/dist/action/components/action.js +3 -2
- package/dist/action/components/action.js.map +1 -1
- package/dist/action/hooks/use-action.js +4 -3
- package/dist/action/hooks/use-action.js.map +1 -1
- package/dist/appearance/index.d.ts +1 -1
- package/dist/appearance/index.js +8 -8
- package/dist/appearance/index.js.map +1 -1
- package/dist/chat/components/chat-box.js +1 -1
- package/dist/chat/components/prompt-input.js +1 -2
- package/dist/chat/components/prompt-input.js.map +1 -1
- package/dist/core/api.d.ts +13 -0
- package/dist/core/api.js +38 -4
- package/dist/core/api.js.map +1 -1
- package/dist/core/component-ref.d.ts +3 -0
- package/dist/core/component-ref.js +20 -2
- package/dist/core/component-ref.js.map +1 -1
- package/dist/core/headers.js +1 -1
- package/dist/core/index.js +4 -4
- package/dist/create-app.js +8 -3
- package/dist/create-app.js.map +1 -1
- package/dist/dnd/index.d.ts +16 -0
- package/dist/dnd/index.js +13 -0
- package/dist/form/components/base/submit-button.d.ts +4 -3
- package/dist/form/components/base/submit-button.js +2 -1
- package/dist/form/components/base/submit-button.js.map +1 -1
- package/dist/form/components/fields/date-picker-field.js +2 -2
- package/dist/form/components/fields/date-picker-field.js.map +1 -1
- package/dist/form/components/fields/file-upload.js +3 -2
- package/dist/form/components/fields/file-upload.js.map +1 -1
- package/dist/form/components/fields/number-input.js +1 -1
- package/dist/form/components/fields/number-input.js.map +1 -1
- package/dist/form/components/fields/rich-editor-field.js +1 -1
- package/dist/form/components/fields/rich-editor-field.js.map +1 -1
- package/dist/form/components/fields/row-action-menu.js +3 -3
- package/dist/form/components/fields/row-action-menu.js.map +1 -1
- package/dist/form/components/fields/row-actions.d.ts +1 -1
- package/dist/form/components/fields/row-actions.js +4 -4
- package/dist/form/components/fields/row-actions.js.map +1 -1
- package/dist/form/components/fields/select.js +4 -3
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/toggle.js +1 -1
- package/dist/form/components/fields/toggle.js.map +1 -1
- package/dist/form/components/form.js +69 -29
- package/dist/form/components/form.js.map +1 -1
- package/dist/form/components/wizard.js +1 -1
- package/dist/form/components/wizard.js.map +1 -1
- package/dist/form/hooks/use-form-resolver.js +1 -1
- package/dist/form/hooks/use-form-resolver.js.map +1 -1
- package/dist/form/hooks/values.d.ts +8 -0
- package/dist/form/hooks/values.js +18 -1
- package/dist/form/hooks/values.js.map +1 -1
- package/dist/i18n/backend.js +1 -1
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/timezone.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/inertia.d.ts +7 -0
- package/dist/inertia.js +19 -1
- package/dist/inertia.js.map +1 -1
- package/dist/lattice.css +189 -116
- package/dist/notifications/components/notification-item.js +3 -1
- package/dist/notifications/components/notification-item.js.map +1 -1
- package/dist/notifications/components/notifications.js +2 -4
- package/dist/notifications/components/notifications.js.map +1 -1
- package/dist/remote/components/data-list.js +2 -2
- package/dist/table/components/bulk-bar.js +3 -1
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.js +3 -6
- package/dist/table/components/cells/badge-cell.js.map +1 -1
- package/dist/table/components/cells/text-cell.js +6 -9
- package/dist/table/components/cells/text-cell.js.map +1 -1
- package/dist/table/components/column-filter-control.js +2 -2
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/filter-bar.js +1 -1
- package/dist/table/components/filter-bar.js.map +1 -1
- package/dist/table/components/pagination.js +6 -6
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/hooks/use-table.js +3 -2
- package/dist/table/hooks/use-table.js.map +1 -1
- package/dist/table/lib/bulk.d.ts +3 -2
- package/dist/table/lib/bulk.js +2 -1
- package/dist/table/lib/bulk.js.map +1 -1
- package/dist/toast/toast.js +3 -1
- package/dist/toast/toast.js.map +1 -1
- package/dist/toast/variant-styles.js +15 -1
- package/dist/toast/variant-styles.js.map +1 -1
- package/dist/types/generated.d.ts +14 -9
- package/dist/ui/action-menu-context.d.ts +1 -1
- package/dist/ui/action-menu-context.js +1 -1
- package/dist/ui/action-menu-context.js.map +1 -1
- package/dist/ui/affix-group.js +1 -1
- package/dist/ui/affix-group.js.map +1 -1
- package/dist/ui/badge.d.ts +4 -7
- package/dist/ui/badge.js +11 -17
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/button.d.ts +6 -5
- package/dist/ui/button.js +154 -15
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/chart-view.js +9 -7
- package/dist/ui/chart-view.js.map +1 -1
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/confirm-dialog.d.ts +4 -3
- package/dist/ui/confirm-dialog.js +3 -2
- package/dist/ui/confirm-dialog.js.map +1 -1
- package/dist/ui/control.d.ts +1 -1
- package/dist/ui/control.js +1 -1
- package/dist/ui/control.js.map +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts +2 -2
- package/dist/ui/dropdown-menu.js +2 -2
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/fragment.js +1 -1
- package/dist/ui/icon-button.d.ts +3 -3
- package/dist/ui/icon-button.js +6 -6
- package/dist/ui/icon-button.js.map +1 -1
- package/dist/ui/image-preview.js +1 -1
- package/dist/ui/image-preview.js.map +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +2 -2
- package/dist/ui/info-tooltip.js +1 -1
- package/dist/ui/info-tooltip.js.map +1 -1
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/password-input.js +1 -1
- package/dist/ui/password-input.js.map +1 -1
- package/dist/ui/progress.js +2 -2
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/text.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/dist/ui/tooltip.js.map +1 -1
- package/dist-standalone/chunks/{chart-view-DEwGTt9d.js → chart-view-CpYsLvzR.js} +4 -4
- package/dist-standalone/chunks/date-picker-field-lX8N40Ii.js +1 -0
- package/dist-standalone/chunks/{page-props-D3FnL614.js → page-props-ClpVjpOc.js} +1 -1
- package/dist-standalone/chunks/{rich-editor-field-B9Nv1qia.js → rich-editor-field-C71csVJv.js} +2 -2
- package/dist-standalone/chunks/{subscriptions-C-0lSr7X.js → subscriptions-Bt2s3IF3.js} +1 -1
- package/dist-standalone/chunks/use-effect-dispatcher-DGFXSzA6.js +97 -0
- package/dist-standalone/lattice.css +1 -1
- package/dist-standalone/lattice.js +15 -15
- package/dist-standalone/manifest.json +8 -8
- package/package.json +9 -1
- package/dist-standalone/chunks/date-picker-field-CCQ9nWx0.js +0 -1
- package/dist-standalone/chunks/use-effect-dispatcher-EVZxmfoo.js +0 -97
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { getActionEffects, isActionEffect, dispatchEffects, dispatchActionError,
|
|
|
5
5
|
export { useEffectDispatcher } from './effects/use-effect-dispatcher.js';
|
|
6
6
|
export { builtinEffectHandlers, effectHandler, mergeEffectHandlers } from './effects/registry.js';
|
|
7
7
|
export { registerRichEditorExtension } from './form/rich-editor/registry.js';
|
|
8
|
-
export {
|
|
8
|
+
export { initializeAppearance, updateAppearance, useAppearance } from './appearance/index.js';
|
|
9
9
|
export { copyToClipboard } from './clipboard/index.js';
|
|
10
10
|
export { createLatticeApp, type CreateLatticeAppI18nOptions, type CreateLatticeAppOptions, } from './create-app.js';
|
|
11
11
|
export { EventBridge } from './event-bridge.js';
|
|
@@ -22,7 +22,7 @@ export { Renderer } from './core/renderer.js';
|
|
|
22
22
|
export { LATTICE_REF_HEADER, withRefHeader } from './core/component-ref.js';
|
|
23
23
|
export { withHeaders } from './core/headers.js';
|
|
24
24
|
export { LATTICE_EVENT } from './core/event-names.js';
|
|
25
|
-
export type {
|
|
25
|
+
export type { Emphasis } from './ui/button.js';
|
|
26
26
|
export type { ReloadComponentEvent } from './core/event-names.js';
|
|
27
27
|
export type { ComponentProps, KnownPageContainer, LayoutPayload, Node, NodeProps, NodeType, PageContainer, PageBreadcrumb, PagePayload, ComponentPropsOf, RendererComponent, RendererComponentModule, RendererComponentProps, Schema, UnknownComponent, } from './core/types.js';
|
|
28
28
|
export { RealtimeListeners } from './realtime/listeners.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createPlugin, createRegistry, eagerComponent, extendRegistry, lazyComponent } from "./core/registry.js";
|
|
3
|
-
import { useColumnRegistry, useComponentRegistry } from "./core/registry-context.js";
|
|
4
|
-
import { LATTICE_EVENT } from "./core/event-names.js";
|
|
1
|
+
import { initializeAppearance, updateAppearance, useAppearance } from "./appearance/index.js";
|
|
5
2
|
import { LATTICE_REF_HEADER, withRefHeader } from "./core/component-ref.js";
|
|
3
|
+
import { LATTICE_EVENT } from "./core/event-names.js";
|
|
6
4
|
import { withHeaders } from "./core/headers.js";
|
|
5
|
+
import { createPlugin, createRegistry, eagerComponent, extendRegistry, lazyComponent } from "./core/registry.js";
|
|
6
|
+
import { useColumnRegistry, useComponentRegistry } from "./core/registry-context.js";
|
|
7
7
|
import { Icon, SpriteProvider } from "./icons/sprite.js";
|
|
8
8
|
import { IconRenderer, IconRendererProvider } from "./icons/icon-renderer.js";
|
|
9
9
|
import { CollapsedContext, useCollapsed } from "./core/collapsed-context.js";
|
|
@@ -29,4 +29,4 @@ import { registry } from "./registry.js";
|
|
|
29
29
|
import { createLatticeApp } from "./create-app.js";
|
|
30
30
|
import { registerRichEditorExtension } from "./form/rich-editor/registry.js";
|
|
31
31
|
import { Provider } from "./provider.js";
|
|
32
|
-
export { Callouts, EventBridge, Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, OutletContext, Provider, RealtimeListeners, Renderer, SchemaLayout, CollapsedContext as SidebarCollapsedContext, SpriteProvider, Toaster, builtinEffectHandlers, chatComponents, columnCell, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createPlugin, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects,
|
|
32
|
+
export { Callouts, EventBridge, Icon, IconRenderer, IconRendererProvider, LATTICE_EVENT, LATTICE_REF_HEADER, OutletContext, Provider, RealtimeListeners, Renderer, SchemaLayout, CollapsedContext as SidebarCollapsedContext, SpriteProvider, Toaster, builtinEffectHandlers, chatComponents, columnCell, copyToClipboard, createLatticeApp, createLayoutResolver, createPageResolver, createPlugin, createRegistry, dispatchActionError, dispatchEffects, eagerComponent, effectHandler, extendRegistry, getActionEffects, initializeAppearance, isActionEffect, layoutComponents, lazyComponent, mergeEffectHandlers, onCallout, onToast, pageComponentName, registerRichEditorExtension, registry, updateAppearance, useAppearance, useChat, useColumnRegistry, useComponentRegistry, useEffectDispatcher, useCollapsed as useSidebarCollapsed, withHeaders, withRefHeader, withVisitHeaders };
|
package/dist/inertia.d.ts
CHANGED
|
@@ -11,3 +11,10 @@ export type CreateLayoutResolverOptions = {
|
|
|
11
11
|
export declare function createPageResolver(pages: PageModules): (name: string) => ResolvedPage;
|
|
12
12
|
export declare function createLayoutResolver({ defaultLayout }?: CreateLayoutResolverOptions): (name: string, page: InertiaPage) => unknown;
|
|
13
13
|
export declare function withVisitHeaders(_href: string, options: VisitOptions): VisitOptions;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the outgoing X-Lattice-Ref header through the renewed-token map at
|
|
16
|
+
* request time. Component props bake the originally sealed ref into headers at
|
|
17
|
+
* render time, so without this rewrite an Inertia request fired between a
|
|
18
|
+
* renewal and the next re-render would still carry the expired token.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerRefRenewal(): void;
|
package/dist/inertia.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { LATTICE_REF_HEADER, latestRef } from "./core/component-ref.js";
|
|
1
2
|
import { withHeaders } from "./core/headers.js";
|
|
2
3
|
import SchemaLayout from "./layout/components/schema-layout.js";
|
|
3
4
|
import Page from "./page.js";
|
|
5
|
+
import { http } from "@inertiajs/react";
|
|
4
6
|
//#region resources/js/inertia.ts
|
|
5
7
|
var pageComponentName = "lattice/page";
|
|
6
8
|
function createPageResolver(pages) {
|
|
@@ -23,7 +25,23 @@ function withVisitHeaders(_href, options) {
|
|
|
23
25
|
headers: withHeaders("", options.headers)
|
|
24
26
|
};
|
|
25
27
|
}
|
|
28
|
+
var refRenewalRegistered = false;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the outgoing X-Lattice-Ref header through the renewed-token map at
|
|
31
|
+
* request time. Component props bake the originally sealed ref into headers at
|
|
32
|
+
* render time, so without this rewrite an Inertia request fired between a
|
|
33
|
+
* renewal and the next re-render would still carry the expired token.
|
|
34
|
+
*/
|
|
35
|
+
function registerRefRenewal() {
|
|
36
|
+
if (refRenewalRegistered) return;
|
|
37
|
+
refRenewalRegistered = true;
|
|
38
|
+
http.onRequest((config) => {
|
|
39
|
+
const sealed = config.headers?.[LATTICE_REF_HEADER];
|
|
40
|
+
if (config.headers && typeof sealed === "string" && sealed !== "") config.headers[LATTICE_REF_HEADER] = latestRef(sealed);
|
|
41
|
+
return config;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
26
44
|
//#endregion
|
|
27
|
-
export { createLayoutResolver, createPageResolver, pageComponentName, withVisitHeaders };
|
|
45
|
+
export { createLayoutResolver, createPageResolver, pageComponentName, registerRefRenewal, withVisitHeaders };
|
|
28
46
|
|
|
29
47
|
//# sourceMappingURL=inertia.js.map
|
package/dist/inertia.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inertia.js","names":[],"sources":["../resources/js/inertia.ts"],"sourcesContent":["import type { Page as InertiaPage, VisitOptions } from \"@inertiajs/core\";\nimport type
|
|
1
|
+
{"version":3,"file":"inertia.js","names":[],"sources":["../resources/js/inertia.ts"],"sourcesContent":["import type { Page as InertiaPage, VisitOptions } from \"@inertiajs/core\";\nimport { http, type ResolvedComponent } from \"@inertiajs/react\";\nimport { LATTICE_REF_HEADER, latestRef } from \"./core/component-ref\";\nimport { withHeaders } from \"./core/headers\";\nimport { SchemaLayout } from \"./layout\";\nimport Page from \"./page\";\nimport type { PagePayload } from \"./core/types\";\n\nexport const pageComponentName = \"lattice/page\";\n\nexport type ResolvedPage =\n | ResolvedComponent\n | Promise<ResolvedComponent>\n | { default: ResolvedComponent };\nexport type PageModules = Record<string, () => Promise<ResolvedComponent>>;\n\nexport type CreateLayoutResolverOptions = {\n defaultLayout?: (name: string, page: InertiaPage) => unknown;\n};\n\nexport function createPageResolver(pages: PageModules) {\n return (name: string): ResolvedPage => {\n if (name === pageComponentName) {\n return { default: Page };\n }\n\n const resolvedPage = pages[`./Pages/${name}.tsx`] ?? pages[`./pages/${name}.tsx`];\n\n if (resolvedPage) {\n return resolvedPage();\n }\n\n throw new Error(`Page not found: ${name}`);\n };\n}\n\nexport function createLayoutResolver({ defaultLayout }: CreateLayoutResolverOptions = {}) {\n return (name: string, page: InertiaPage): unknown => {\n if (name === pageComponentName) {\n const lattice = page.props.lattice as PagePayload | undefined;\n\n return lattice?.layout ? SchemaLayout : null;\n }\n\n return defaultLayout?.(name, page) ?? null;\n };\n}\n\nexport function withVisitHeaders(_href: string, options: VisitOptions): VisitOptions {\n return {\n ...options,\n headers: withHeaders(\"\", options.headers),\n };\n}\n\nlet refRenewalRegistered = false;\n\n/**\n * Resolve the outgoing X-Lattice-Ref header through the renewed-token map at\n * request time. Component props bake the originally sealed ref into headers at\n * render time, so without this rewrite an Inertia request fired between a\n * renewal and the next re-render would still carry the expired token.\n */\nexport function registerRefRenewal(): void {\n if (refRenewalRegistered) {\n return;\n }\n\n refRenewalRegistered = true;\n\n http.onRequest((config) => {\n const sealed = config.headers?.[LATTICE_REF_HEADER];\n\n if (config.headers && typeof sealed === \"string\" && sealed !== \"\") {\n config.headers[LATTICE_REF_HEADER] = latestRef(sealed);\n }\n\n return config;\n });\n}\n"],"mappings":";;;;;;AAQA,IAAa,oBAAoB;AAYjC,SAAgB,mBAAmB,OAAoB;CACrD,QAAQ,SAA+B;EACrC,IAAI,SAAA,gBACF,OAAO,EAAE,SAAS,KAAK;EAGzB,MAAM,eAAe,MAAM,WAAW,KAAK,UAAU,MAAM,WAAW,KAAK;EAE3E,IAAI,cACF,OAAO,aAAa;EAGtB,MAAM,IAAI,MAAM,mBAAmB,MAAM;CAC3C;AACF;AAEA,SAAgB,qBAAqB,EAAE,kBAA+C,CAAC,GAAG;CACxF,QAAQ,MAAc,SAA+B;EACnD,IAAI,SAAA,gBAGF,OAFgB,KAAK,MAAM,SAEX,SAAS,eAAe;EAG1C,OAAO,gBAAgB,MAAM,IAAI,KAAK;CACxC;AACF;AAEA,SAAgB,iBAAiB,OAAe,SAAqC;CACnF,OAAO;EACL,GAAG;EACH,SAAS,YAAY,IAAI,QAAQ,OAAO;CAC1C;AACF;AAEA,IAAI,uBAAuB;;;;;;;AAQ3B,SAAgB,qBAA2B;CACzC,IAAI,sBACF;CAGF,uBAAuB;CAEvB,KAAK,WAAW,WAAW;EACzB,MAAM,SAAS,OAAO,UAAU;EAEhC,IAAI,OAAO,WAAW,OAAO,WAAW,YAAY,WAAW,IAC7D,OAAO,QAAQ,sBAAsB,UAAU,MAAM;EAGvD,OAAO;CACT,CAAC;AACH"}
|
package/dist/lattice.css
CHANGED
|
@@ -1,49 +1,87 @@
|
|
|
1
1
|
@source "./**/*.js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
--lt-
|
|
12
|
-
--lt-
|
|
13
|
-
--lt-
|
|
14
|
-
--lt-
|
|
15
|
-
--lt-
|
|
16
|
-
--lt-
|
|
17
|
-
--lt-
|
|
18
|
-
--lt-
|
|
19
|
-
--lt-
|
|
20
|
-
--lt-
|
|
21
|
-
--lt-
|
|
22
|
-
--lt-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
--lt-
|
|
26
|
-
--lt-
|
|
27
|
-
--lt-
|
|
28
|
-
--lt-
|
|
29
|
-
--lt-
|
|
30
|
-
--lt-
|
|
31
|
-
--lt-
|
|
32
|
-
--lt-
|
|
33
|
-
--lt-
|
|
34
|
-
--lt-
|
|
35
|
-
--lt-success
|
|
36
|
-
--lt-
|
|
37
|
-
--lt-info
|
|
38
|
-
--lt-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
3
|
+
/*
|
|
4
|
+
* Token defaults live in a cascade layer so any unlayered override wins
|
|
5
|
+
* regardless of stylesheet order — the @latticeTheme style tag and plain
|
|
6
|
+
* `:root { --lt-primary: … }` rules in an app's CSS both take precedence.
|
|
7
|
+
*/
|
|
8
|
+
@layer lattice {
|
|
9
|
+
:root,
|
|
10
|
+
[data-theme="light"] {
|
|
11
|
+
--lt-bg: oklch(0.976 0.003 210);
|
|
12
|
+
--lt-fg: oklch(0.18 0.01 220);
|
|
13
|
+
--lt-surface: oklch(1 0 0);
|
|
14
|
+
--lt-surface-fg: oklch(0.18 0.01 220);
|
|
15
|
+
--lt-popover: oklch(1 0 0);
|
|
16
|
+
--lt-popover-fg: oklch(0.18 0.01 220);
|
|
17
|
+
--lt-primary: oklch(0.51 0.12 195);
|
|
18
|
+
--lt-primary-fg: oklch(0.985 0 0);
|
|
19
|
+
--lt-secondary: oklch(0.955 0.005 210);
|
|
20
|
+
--lt-secondary-fg: oklch(0.25 0.012 220);
|
|
21
|
+
--lt-muted: oklch(0.955 0.004 210);
|
|
22
|
+
--lt-muted-fg: oklch(0.52 0.015 220);
|
|
23
|
+
/* Accent tint and focus ring take their hue from the primary, so a themed
|
|
24
|
+
primary keeps them coherent; an explicit override still wins. */
|
|
25
|
+
--lt-accent: oklch(from var(--lt-primary) 0.95 0.024 h);
|
|
26
|
+
--lt-accent-fg: oklch(from var(--lt-primary) 0.36 0.085 h);
|
|
27
|
+
--lt-danger: oklch(0.55 0.2 26);
|
|
28
|
+
--lt-danger-fg: oklch(0.985 0 0);
|
|
29
|
+
--lt-border: oklch(0.915 0.005 210);
|
|
30
|
+
--lt-input: oklch(0.88 0.007 210);
|
|
31
|
+
--lt-ring: oklch(from var(--lt-primary) 0.7 0.1 h);
|
|
32
|
+
--lt-overlay: oklch(0.15 0.02 225 / 0.5);
|
|
33
|
+
--lt-warning: oklch(0.83 0.15 85);
|
|
34
|
+
--lt-warning-fg: oklch(0.28 0.06 70);
|
|
35
|
+
--lt-success: oklch(0.56 0.13 158);
|
|
36
|
+
--lt-success-fg: oklch(0.985 0 0);
|
|
37
|
+
--lt-info: oklch(0.55 0.13 245);
|
|
38
|
+
--lt-info-fg: oklch(0.985 0 0);
|
|
39
|
+
/* Hover/active derive from the base colour so a themed base recolours its
|
|
40
|
+
whole state family; setting the state token directly still wins. Light
|
|
41
|
+
surfaces darken on interaction, the near-white secondary by less. */
|
|
42
|
+
--lt-primary-hover: oklch(from var(--lt-primary) calc(l - 0.05) c h);
|
|
43
|
+
--lt-primary-active: oklch(from var(--lt-primary) calc(l - 0.1) c h);
|
|
44
|
+
--lt-danger-hover: oklch(from var(--lt-danger) calc(l - 0.05) c h);
|
|
45
|
+
--lt-danger-active: oklch(from var(--lt-danger) calc(l - 0.1) c h);
|
|
46
|
+
--lt-success-hover: oklch(from var(--lt-success) calc(l - 0.05) c h);
|
|
47
|
+
--lt-success-active: oklch(from var(--lt-success) calc(l - 0.1) c h);
|
|
48
|
+
--lt-info-hover: oklch(from var(--lt-info) calc(l - 0.05) c h);
|
|
49
|
+
--lt-info-active: oklch(from var(--lt-info) calc(l - 0.1) c h);
|
|
50
|
+
--lt-warning-hover: oklch(from var(--lt-warning) calc(l - 0.05) c h);
|
|
51
|
+
--lt-warning-active: oklch(from var(--lt-warning) calc(l - 0.1) c h);
|
|
52
|
+
--lt-secondary-hover: oklch(from var(--lt-secondary) calc(l - 0.03) c h);
|
|
53
|
+
--lt-secondary-active: oklch(from var(--lt-secondary) calc(l - 0.06) c h);
|
|
54
|
+
--lt-disabled: oklch(0.945 0.003 210);
|
|
55
|
+
--lt-disabled-fg: oklch(0.68 0.008 220);
|
|
42
56
|
|
|
43
57
|
/* Radius: base = cards, -sm = controls, -xs = chips */
|
|
44
|
-
--lt-radius:
|
|
58
|
+
--lt-radius: 0.5rem;
|
|
45
59
|
--lt-radius-sm: calc(var(--lt-radius) - 0.125rem);
|
|
46
60
|
--lt-radius-xs: calc(var(--lt-radius) - 0.25rem);
|
|
61
|
+
--lt-radius-lg: calc(var(--lt-radius) + 0.25rem);
|
|
62
|
+
--lt-radius-xl: calc(var(--lt-radius) + 0.5rem);
|
|
63
|
+
--lt-radius-full: 9999px;
|
|
64
|
+
|
|
65
|
+
--lt-ring-width: 3px;
|
|
66
|
+
--lt-ring-offset: 0px;
|
|
67
|
+
|
|
68
|
+
--lt-font-sans:
|
|
69
|
+
"Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
|
|
70
|
+
"Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
|
71
|
+
"Segoe UI Symbol", "Noto Color Emoji";
|
|
72
|
+
--lt-font-mono: ui-monospace, "SFMono-Regular", "Menlo", monospace;
|
|
73
|
+
--lt-font-display: var(--lt-font-sans);
|
|
74
|
+
|
|
75
|
+
--lt-shadow-inner: inset 0 1px 2px 0 oklch(0.2 0.02 225 / 0.06);
|
|
76
|
+
|
|
77
|
+
--lt-chart-1: oklch(0.55 0.12 195);
|
|
78
|
+
--lt-chart-2: oklch(0.58 0.14 250);
|
|
79
|
+
--lt-chart-3: oklch(0.68 0.14 60);
|
|
80
|
+
--lt-chart-4: oklch(0.58 0.19 305);
|
|
81
|
+
--lt-chart-5: oklch(0.6 0.16 20);
|
|
82
|
+
--lt-chart-6: oklch(0.62 0.13 150);
|
|
83
|
+
--lt-chart-7: oklch(0.6 0.13 100);
|
|
84
|
+
--lt-chart-8: oklch(0.55 0.05 280);
|
|
47
85
|
|
|
48
86
|
--lt-icon-xs: 0.75rem;
|
|
49
87
|
--lt-icon-sm: 0.875rem;
|
|
@@ -53,7 +91,6 @@
|
|
|
53
91
|
--lt-icon-2xl: 2rem;
|
|
54
92
|
--lt-icon-3xl: 2.5rem;
|
|
55
93
|
--lt-icon-4xl: 3rem;
|
|
56
|
-
--lt-icon-stroke: 1.5;
|
|
57
94
|
|
|
58
95
|
/* Control heights — density lever */
|
|
59
96
|
--lt-control-h-sm: 2rem;
|
|
@@ -69,12 +106,12 @@
|
|
|
69
106
|
--lt-font-weight-semibold: 600;
|
|
70
107
|
--lt-font-weight-bold: 700;
|
|
71
108
|
|
|
72
|
-
--lt-shadow-xs: 0 1px 1px 0 oklch(0 0
|
|
73
|
-
--lt-shadow-sm: 0 1px 2px 0 oklch(0 0
|
|
109
|
+
--lt-shadow-xs: 0 1px 1px 0 oklch(0.2 0.02 225 / 0.05);
|
|
110
|
+
--lt-shadow-sm: 0 1px 2px 0 oklch(0.2 0.02 225 / 0.06);
|
|
74
111
|
--lt-shadow-md:
|
|
75
|
-
0 2px 4px -1px oklch(0 0
|
|
112
|
+
0 2px 4px -1px oklch(0.2 0.02 225 / 0.09), 0 1px 2px -1px oklch(0.2 0.02 225 / 0.06);
|
|
76
113
|
--lt-shadow-lg:
|
|
77
|
-
0 8px 16px -4px oklch(0 0
|
|
114
|
+
0 8px 16px -4px oklch(0.2 0.02 225 / 0.13), 0 2px 4px -2px oklch(0.2 0.02 225 / 0.08);
|
|
78
115
|
|
|
79
116
|
--lt-z-dropdown: 1000;
|
|
80
117
|
--lt-z-sticky: 1100;
|
|
@@ -95,6 +132,7 @@
|
|
|
95
132
|
--lt-gutter: calc(var(--spacing) * 6);
|
|
96
133
|
|
|
97
134
|
color-scheme: light;
|
|
135
|
+
}
|
|
98
136
|
}
|
|
99
137
|
|
|
100
138
|
/*
|
|
@@ -111,51 +149,68 @@
|
|
|
111
149
|
}
|
|
112
150
|
}
|
|
113
151
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
--lt-
|
|
118
|
-
--lt-
|
|
119
|
-
--lt-surface
|
|
120
|
-
--lt-
|
|
121
|
-
--lt-popover
|
|
122
|
-
--lt-
|
|
123
|
-
--lt-primary
|
|
124
|
-
--lt-
|
|
125
|
-
--lt-secondary
|
|
126
|
-
--lt-
|
|
127
|
-
--lt-muted
|
|
128
|
-
--lt-
|
|
129
|
-
--lt-accent
|
|
130
|
-
--lt-
|
|
131
|
-
--lt-danger
|
|
132
|
-
--lt-
|
|
133
|
-
--lt-
|
|
134
|
-
--lt-
|
|
135
|
-
--lt-
|
|
136
|
-
--lt-
|
|
137
|
-
--lt-
|
|
138
|
-
--lt-
|
|
139
|
-
--lt-
|
|
140
|
-
--lt-
|
|
141
|
-
|
|
142
|
-
--lt-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
--lt-
|
|
146
|
-
--lt-
|
|
147
|
-
--lt-
|
|
148
|
-
--lt-
|
|
149
|
-
--lt-
|
|
150
|
-
--lt-
|
|
151
|
-
--lt-
|
|
152
|
-
--lt-
|
|
153
|
-
--lt-
|
|
152
|
+
@layer lattice {
|
|
153
|
+
[data-theme="dark"],
|
|
154
|
+
.dark {
|
|
155
|
+
--lt-bg: oklch(0.155 0.008 225);
|
|
156
|
+
--lt-fg: oklch(0.955 0.005 210);
|
|
157
|
+
--lt-surface: oklch(0.195 0.01 225);
|
|
158
|
+
--lt-surface-fg: oklch(0.955 0.005 210);
|
|
159
|
+
--lt-popover: oklch(0.225 0.012 225);
|
|
160
|
+
--lt-popover-fg: oklch(0.955 0.005 210);
|
|
161
|
+
--lt-primary: oklch(0.75 0.115 190);
|
|
162
|
+
--lt-primary-fg: oklch(0.17 0.03 195);
|
|
163
|
+
--lt-secondary: oklch(0.27 0.012 225);
|
|
164
|
+
--lt-secondary-fg: oklch(0.955 0.005 210);
|
|
165
|
+
--lt-muted: oklch(0.26 0.01 225);
|
|
166
|
+
--lt-muted-fg: oklch(0.72 0.012 220);
|
|
167
|
+
--lt-accent: oklch(from var(--lt-primary) 0.29 0.03 h);
|
|
168
|
+
--lt-accent-fg: oklch(from var(--lt-primary) 0.97 0.005 h);
|
|
169
|
+
--lt-danger: oklch(0.55 0.18 25);
|
|
170
|
+
--lt-danger-fg: oklch(0.985 0 0);
|
|
171
|
+
--lt-border: oklch(0.285 0.012 225);
|
|
172
|
+
--lt-input: oklch(0.33 0.014 225);
|
|
173
|
+
--lt-ring: oklch(from var(--lt-primary) 0.6 0.1 h);
|
|
174
|
+
--lt-overlay: oklch(0.08 0.01 225 / 0.65);
|
|
175
|
+
--lt-warning: oklch(0.75 0.14 82);
|
|
176
|
+
--lt-warning-fg: oklch(0.28 0.06 70);
|
|
177
|
+
--lt-success: oklch(0.72 0.14 160);
|
|
178
|
+
--lt-success-fg: oklch(0.2 0.04 160);
|
|
179
|
+
--lt-info: oklch(0.72 0.13 242);
|
|
180
|
+
--lt-info-fg: oklch(0.2 0.04 242);
|
|
181
|
+
|
|
182
|
+
/* Dark surfaces lighten on interaction. */
|
|
183
|
+
--lt-primary-hover: oklch(from var(--lt-primary) calc(l + 0.04) c h);
|
|
184
|
+
--lt-primary-active: oklch(from var(--lt-primary) calc(l + 0.08) c h);
|
|
185
|
+
--lt-danger-hover: oklch(from var(--lt-danger) calc(l + 0.04) c h);
|
|
186
|
+
--lt-danger-active: oklch(from var(--lt-danger) calc(l + 0.08) c h);
|
|
187
|
+
--lt-success-hover: oklch(from var(--lt-success) calc(l + 0.04) c h);
|
|
188
|
+
--lt-success-active: oklch(from var(--lt-success) calc(l + 0.08) c h);
|
|
189
|
+
--lt-info-hover: oklch(from var(--lt-info) calc(l + 0.04) c h);
|
|
190
|
+
--lt-info-active: oklch(from var(--lt-info) calc(l + 0.08) c h);
|
|
191
|
+
--lt-warning-hover: oklch(from var(--lt-warning) calc(l + 0.04) c h);
|
|
192
|
+
--lt-warning-active: oklch(from var(--lt-warning) calc(l + 0.08) c h);
|
|
193
|
+
--lt-secondary-hover: oklch(from var(--lt-secondary) calc(l + 0.04) c h);
|
|
194
|
+
--lt-secondary-active: oklch(from var(--lt-secondary) calc(l + 0.08) c h);
|
|
195
|
+
--lt-disabled: oklch(0.28 0.01 225);
|
|
196
|
+
--lt-disabled-fg: oklch(0.56 0.012 225);
|
|
197
|
+
|
|
198
|
+
--lt-chart-1: oklch(0.72 0.12 190);
|
|
199
|
+
--lt-chart-2: oklch(0.7 0.12 250);
|
|
200
|
+
--lt-chart-3: oklch(0.76 0.14 60);
|
|
201
|
+
--lt-chart-4: oklch(0.7 0.16 305);
|
|
202
|
+
--lt-chart-5: oklch(0.7 0.16 20);
|
|
203
|
+
--lt-chart-6: oklch(0.74 0.12 150);
|
|
204
|
+
--lt-chart-7: oklch(0.72 0.12 100);
|
|
205
|
+
--lt-chart-8: oklch(0.68 0.05 280);
|
|
154
206
|
|
|
155
207
|
color-scheme: dark;
|
|
208
|
+
}
|
|
156
209
|
}
|
|
157
210
|
|
|
158
211
|
@theme inline {
|
|
212
|
+
--font-sans: var(--lt-font-sans);
|
|
213
|
+
--font-mono: var(--lt-font-mono);
|
|
159
214
|
--color-lt-bg: var(--lt-bg);
|
|
160
215
|
--color-lt-fg: var(--lt-fg);
|
|
161
216
|
--color-lt-surface: var(--lt-surface);
|
|
@@ -189,6 +244,8 @@
|
|
|
189
244
|
--color-lt-success-active: var(--lt-success-active);
|
|
190
245
|
--color-lt-info-hover: var(--lt-info-hover);
|
|
191
246
|
--color-lt-info-active: var(--lt-info-active);
|
|
247
|
+
--color-lt-warning-hover: var(--lt-warning-hover);
|
|
248
|
+
--color-lt-warning-active: var(--lt-warning-active);
|
|
192
249
|
--color-lt-secondary-hover: var(--lt-secondary-hover);
|
|
193
250
|
--color-lt-secondary-active: var(--lt-secondary-active);
|
|
194
251
|
--color-lt-disabled: var(--lt-disabled);
|
|
@@ -200,6 +257,24 @@
|
|
|
200
257
|
--shadow-lt-sm: var(--lt-shadow-sm);
|
|
201
258
|
--shadow-lt-md: var(--lt-shadow-md);
|
|
202
259
|
--shadow-lt-lg: var(--lt-shadow-lg);
|
|
260
|
+
--shadow-lt-inner: var(--lt-shadow-inner);
|
|
261
|
+
--radius-lt-lg: var(--lt-radius-lg);
|
|
262
|
+
--radius-lt-xl: var(--lt-radius-xl);
|
|
263
|
+
--radius-lt-full: var(--lt-radius-full);
|
|
264
|
+
--color-lt-warning-fg: var(--lt-warning-fg);
|
|
265
|
+
--color-lt-chart-1: var(--lt-chart-1);
|
|
266
|
+
--color-lt-chart-2: var(--lt-chart-2);
|
|
267
|
+
--color-lt-chart-3: var(--lt-chart-3);
|
|
268
|
+
--color-lt-chart-4: var(--lt-chart-4);
|
|
269
|
+
--color-lt-chart-5: var(--lt-chart-5);
|
|
270
|
+
--color-lt-chart-6: var(--lt-chart-6);
|
|
271
|
+
--color-lt-chart-7: var(--lt-chart-7);
|
|
272
|
+
--color-lt-chart-8: var(--lt-chart-8);
|
|
273
|
+
--font-lt-mono: var(--lt-font-mono);
|
|
274
|
+
--font-lt-display: var(--lt-font-display);
|
|
275
|
+
--spacing-lt-sidebar: var(--lt-sidebar-w);
|
|
276
|
+
--spacing-lt-sidebar-collapsed: var(--lt-sidebar-w-collapsed);
|
|
277
|
+
--spacing-lt-container: var(--lt-container-max);
|
|
203
278
|
--spacing-lt-icon-xs: var(--lt-icon-xs);
|
|
204
279
|
--spacing-lt-icon-sm: var(--lt-icon-sm);
|
|
205
280
|
--spacing-lt-icon-md: var(--lt-icon-md);
|
|
@@ -231,34 +306,30 @@
|
|
|
231
306
|
}
|
|
232
307
|
|
|
233
308
|
@theme {
|
|
234
|
-
--font-sans:
|
|
235
|
-
"Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
|
|
236
|
-
"Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
|
237
|
-
"Segoe UI Symbol", "Noto Color Emoji";
|
|
238
309
|
|
|
239
310
|
--spacing: 0.25rem;
|
|
240
311
|
|
|
241
|
-
--text-xs: 0.
|
|
242
|
-
--text-xs--line-height: 1.
|
|
243
|
-
--text-sm: 0.
|
|
244
|
-
--text-sm--line-height: 1.
|
|
245
|
-
--text-base: 0.
|
|
246
|
-
--text-base--line-height: 1.
|
|
247
|
-
--text-lg:
|
|
248
|
-
--text-lg--line-height: 1.
|
|
249
|
-
--text-xl:
|
|
250
|
-
--text-xl--line-height: 1.
|
|
251
|
-
--text-2xl: 1.
|
|
252
|
-
--text-2xl--line-height: 1.
|
|
253
|
-
--text-3xl: 1.
|
|
254
|
-
--text-3xl--line-height: 1.
|
|
255
|
-
--text-4xl:
|
|
256
|
-
--text-4xl--line-height: 1.
|
|
257
|
-
--text-5xl:
|
|
258
|
-
--text-5xl--line-height: 1;
|
|
259
|
-
--text-6xl:
|
|
312
|
+
--text-xs: 0.75rem;
|
|
313
|
+
--text-xs--line-height: 1.5;
|
|
314
|
+
--text-sm: 0.8125rem;
|
|
315
|
+
--text-sm--line-height: 1.5385;
|
|
316
|
+
--text-base: 0.875rem;
|
|
317
|
+
--text-base--line-height: 1.5714;
|
|
318
|
+
--text-lg: 1rem;
|
|
319
|
+
--text-lg--line-height: 1.5;
|
|
320
|
+
--text-xl: 1.125rem;
|
|
321
|
+
--text-xl--line-height: 1.5556;
|
|
322
|
+
--text-2xl: 1.375rem;
|
|
323
|
+
--text-2xl--line-height: 1.2727;
|
|
324
|
+
--text-3xl: 1.625rem;
|
|
325
|
+
--text-3xl--line-height: 1.2308;
|
|
326
|
+
--text-4xl: 2rem;
|
|
327
|
+
--text-4xl--line-height: 1.25;
|
|
328
|
+
--text-5xl: 2.5rem;
|
|
329
|
+
--text-5xl--line-height: 1.1;
|
|
330
|
+
--text-6xl: 3rem;
|
|
260
331
|
--text-6xl--line-height: 1;
|
|
261
|
-
--text-7xl:
|
|
332
|
+
--text-7xl: 3.75rem;
|
|
262
333
|
--text-7xl--line-height: 1;
|
|
263
334
|
}
|
|
264
335
|
|
|
@@ -399,7 +470,8 @@
|
|
|
399
470
|
* theme and can be overridden, and so a colour can be picked by name at
|
|
400
471
|
* runtime without Tailwind needing to see every class.
|
|
401
472
|
*/
|
|
402
|
-
|
|
473
|
+
@layer lattice {
|
|
474
|
+
:root {
|
|
403
475
|
--lt-color-default: var(--lt-fg);
|
|
404
476
|
--lt-color-muted: var(--lt-muted-fg);
|
|
405
477
|
--lt-color-primary: var(--lt-primary);
|
|
@@ -414,19 +486,20 @@
|
|
|
414
486
|
--lt-color-green: oklch(0.52 0.13 152);
|
|
415
487
|
--lt-color-blue: oklch(0.54 0.17 252);
|
|
416
488
|
--lt-color-purple: oklch(0.53 0.19 305);
|
|
417
|
-
}
|
|
489
|
+
}
|
|
418
490
|
|
|
419
|
-
[data-theme="dark"],
|
|
420
|
-
.dark {
|
|
491
|
+
[data-theme="dark"],
|
|
492
|
+
.dark {
|
|
421
493
|
--lt-color-red: oklch(0.83 0.11 27);
|
|
422
494
|
--lt-color-orange: oklch(0.84 0.1 65);
|
|
423
495
|
--lt-color-yellow: oklch(0.87 0.11 100);
|
|
424
496
|
--lt-color-green: oklch(0.85 0.13 155);
|
|
425
497
|
--lt-color-blue: oklch(0.84 0.11 250);
|
|
426
498
|
--lt-color-purple: oklch(0.85 0.11 305);
|
|
499
|
+
}
|
|
427
500
|
}
|
|
428
501
|
|
|
429
|
-
.lt-
|
|
502
|
+
.lt-badge {
|
|
430
503
|
display: inline-flex;
|
|
431
504
|
align-items: center;
|
|
432
505
|
gap: 0.25rem;
|
|
@@ -631,7 +704,7 @@
|
|
|
631
704
|
background: var(--lt-muted);
|
|
632
705
|
border-radius: var(--lt-radius-sm);
|
|
633
706
|
padding: calc(var(--spacing) * 0.5) var(--spacing);
|
|
634
|
-
font-family:
|
|
707
|
+
font-family: var(--lt-font-mono);
|
|
635
708
|
font-size: 0.875em;
|
|
636
709
|
}
|
|
637
710
|
|
|
@@ -641,7 +714,7 @@
|
|
|
641
714
|
padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
|
|
642
715
|
margin: calc(var(--spacing) * 3) 0;
|
|
643
716
|
overflow-x: auto;
|
|
644
|
-
font-family:
|
|
717
|
+
font-family: var(--lt-font-mono);
|
|
645
718
|
font-size: var(--text-lg);
|
|
646
719
|
}
|
|
647
720
|
|
|
@@ -7,10 +7,12 @@ import { Link } from "@inertiajs/react";
|
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region resources/js/notifications/components/notification-item.tsx
|
|
9
9
|
var variantIconClass = {
|
|
10
|
+
primary: "text-lt-primary",
|
|
11
|
+
secondary: "text-lt-muted-fg",
|
|
10
12
|
success: "text-lt-success",
|
|
11
13
|
info: "text-lt-info",
|
|
12
14
|
warning: "text-lt-warning",
|
|
13
|
-
|
|
15
|
+
danger: "text-lt-danger"
|
|
14
16
|
};
|
|
15
17
|
function NotificationItemRow({ notification, onMarkRead, onDismiss }) {
|
|
16
18
|
const { t } = useT("lattice");
|
|
@@ -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 success: \"text-lt-success\",\n info: \"text-lt-info\",\n warning: \"text-lt-warning\",\n
|
|
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"}
|
|
@@ -2,7 +2,6 @@ import { useT } from "../../i18n/instance.js";
|
|
|
2
2
|
import { Icon } from "../../icons/sprite.js";
|
|
3
3
|
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
4
4
|
import { Dialog, DialogContent, DialogTitle } from "../../ui/dialog.js";
|
|
5
|
-
import { Badge } from "../../ui/badge.js";
|
|
6
5
|
import { useNotifications } from "../store.js";
|
|
7
6
|
import { NotificationList } from "./notification-list.js";
|
|
8
7
|
import { Component, Suspense, lazy } from "react";
|
|
@@ -33,10 +32,9 @@ var NotificationsComponent = ({ node }) => {
|
|
|
33
32
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
34
33
|
name: "bell",
|
|
35
34
|
className: "size-lt-icon-md"
|
|
36
|
-
}), store.unreadCount > 0 ? /* @__PURE__ */ jsx(
|
|
37
|
-
variant: "destructive",
|
|
35
|
+
}), store.unreadCount > 0 ? /* @__PURE__ */ jsx("span", {
|
|
38
36
|
"data-test": "notifications-badge",
|
|
39
|
-
className: "absolute -right-0.5 -top-0.5 min-w-4 px-1 py-0 text-[10px]",
|
|
37
|
+
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",
|
|
40
38
|
children: store.unreadCount
|
|
41
39
|
}) : null]
|
|
42
40
|
});
|
|
@@ -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 {
|
|
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,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;YAAhB,CACE,oBAAC,MAAD;GAAM,MAAK;GAAO,WAAU;EAAmB,CAAA,GAC9C,MAAM,cAAc,IACnB,oBAAC,QAAD;GACE,aAAU;GACV,WAAU;aAET,MAAM;EACH,CAAA,IACJ,IACA;;CAGR,MAAM,QACJ,qBAAC,OAAD;EAAK,WAAU;EAAO,aAAU;YAAhC,CACE,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,QAAD;IAAM,WAAU;cAAuB,EAAE,yBAAyB,eAAe;GAAQ,CAAA,GACxF,MAAM,cAAc,IACnB,oBAAC,UAAD;IACE,MAAK;IACL,WAAU;IACV,SAAS,MAAM;cAEd,EAAE,+BAA+B,eAAe;GAC3C,CAAA,IACN,IACD;MACL,oBAAC,kBAAD;GACE,eAAe,MAAM;GACrB,QAAQ,MAAM;GACd,SAAS,MAAM;GACf,YAAY,MAAM;GAClB,WAAW,MAAM;GACjB,YAAY,MAAM;EACnB,CAAA,CACE;;CAGP,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,KAAK,MAAM,UACV,oBAAC,cAAD,EAAA,UACE,oBAAC,UAAD;EAAU,UAAU;YAClB,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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { remoteJson } from "../../core/api.js";
|
|
2
2
|
import { materializeSchema } from "../../core/materialize.js";
|
|
3
|
+
import { useT } from "../../i18n/instance.js";
|
|
3
4
|
import { Renderer } from "../../core/renderer.js";
|
|
4
|
-
import { remoteJson } from "../../core/api.js";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region resources/js/remote/components/data-list.tsx
|