@lattice-php/lattice 0.17.1 → 0.17.2

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 (68) hide show
  1. package/dist/chat/index.d.ts +1 -1
  2. package/dist/chat/index.js +3 -3
  3. package/dist/chat/index.js.map +1 -1
  4. package/dist/core/components/chart-view.d.ts +3 -0
  5. package/dist/core/components/chart-view.js +225 -0
  6. package/dist/core/components/chart-view.js.map +1 -0
  7. package/dist/core/components/chart.js +10 -220
  8. package/dist/core/components/chart.js.map +1 -1
  9. package/dist/core/components/index.js +3 -2
  10. package/dist/core/components/index.js.map +1 -1
  11. package/dist/create-app.js +3 -3
  12. package/dist/create-app.js.map +1 -1
  13. package/dist/form/components/fields/date-input.js +2 -2
  14. package/dist/form/components/fields/date-input.js.map +1 -1
  15. package/dist/form/components/fields/{date-picker-control.d.ts → date-picker-field.d.ts} +2 -2
  16. package/dist/form/components/fields/{date-picker-control.js → date-picker-field.js} +4 -4
  17. package/dist/form/components/fields/date-picker-field.js.map +1 -0
  18. package/dist/form/components/fields/date-picker.d.ts +2 -0
  19. package/dist/form/components/fields/date-picker.js +17 -0
  20. package/dist/form/components/fields/date-picker.js.map +1 -0
  21. package/dist/form/components/fields/date-time-input.js +2 -2
  22. package/dist/form/components/fields/date-time-input.js.map +1 -1
  23. package/dist/form/components/fields/rich-editor-field.d.ts +3 -0
  24. package/dist/form/components/fields/rich-editor-field.js +340 -0
  25. package/dist/form/components/fields/rich-editor-field.js.map +1 -0
  26. package/dist/form/components/fields/rich-editor.js +10 -335
  27. package/dist/form/components/fields/rich-editor.js.map +1 -1
  28. package/dist/form/components/fields/table-rows.js +2 -2
  29. package/dist/form/index.js +37 -29
  30. package/dist/form/index.js.map +1 -1
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.js +4 -4
  33. package/dist/notifications/index.d.ts +1 -1
  34. package/dist/notifications/index.js +2 -2
  35. package/dist/notifications/index.js.map +1 -1
  36. package/dist/provider.js +4 -4
  37. package/dist/provider.js.map +1 -1
  38. package/dist/registry.d.ts +1 -1
  39. package/dist/registry.js +15 -2
  40. package/dist/registry.js.map +1 -0
  41. package/dist/table/components/cells/money-cell.js +1 -1
  42. package/dist/table/components/cells/number-cell.js +1 -1
  43. package/dist/table/components/table.js +1 -1
  44. package/dist/table/index.js +3 -2
  45. package/dist/table/index.js.map +1 -1
  46. package/package.json +4 -11
  47. package/dist/core/components/eager.d.ts +0 -1
  48. package/dist/core/components/eager.js +0 -50
  49. package/dist/core/components/eager.js.map +0 -1
  50. package/dist/form/components/fields/date-picker-control.js.map +0 -1
  51. package/dist/form/components/fields/lazy-date-picker-control.d.ts +0 -2
  52. package/dist/form/components/fields/lazy-date-picker-control.js +0 -17
  53. package/dist/form/components/fields/lazy-date-picker-control.js.map +0 -1
  54. package/dist/form/eager.d.ts +0 -1
  55. package/dist/form/eager.js +0 -47
  56. package/dist/form/eager.js.map +0 -1
  57. package/dist/form/skeleton.d.ts +0 -2
  58. package/dist/form/skeleton.js +0 -22
  59. package/dist/form/skeleton.js.map +0 -1
  60. package/dist/registry/eager.d.ts +0 -1
  61. package/dist/registry/eager.js +0 -15
  62. package/dist/registry/eager.js.map +0 -1
  63. package/dist/registry/lazy.d.ts +0 -1
  64. package/dist/registry/lazy.js +0 -15
  65. package/dist/registry/lazy.js.map +0 -1
  66. package/dist/table/eager.d.ts +0 -1
  67. package/dist/table/eager.js +0 -11
  68. package/dist/table/eager.js.map +0 -1
@@ -1 +1 @@
1
- export declare const chatPlugin: import('../core/registry').Plugin;
1
+ export declare const chatComponents: import('../core/registry').Plugin;
@@ -3,8 +3,8 @@ import { ChatBox } from "./components/chat-box.js";
3
3
  import { TextPart } from "./parts/text.js";
4
4
  import { ToolCallPart } from "./parts/tool-call.js";
5
5
  //#region resources/js/chat/index.ts
6
- var chatPlugin = createPlugin({
7
- name: "chat",
6
+ var chatComponents = createPlugin({
7
+ name: "lattice/chat",
8
8
  components: {
9
9
  "chat.box": eagerComponent(ChatBox),
10
10
  "chat.part.text": eagerComponent(TextPart),
@@ -12,6 +12,6 @@ var chatPlugin = createPlugin({
12
12
  }
13
13
  });
14
14
  //#endregion
15
- export { chatPlugin };
15
+ export { chatComponents };
16
16
 
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../resources/js/chat/index.ts"],"sourcesContent":["import { createPlugin, eagerComponent } from \"@lattice-php/lattice/core/registry\";\nimport ChatBoxComponent from \"./components/chat-box\";\nimport { TextPart } from \"./parts/text\";\nimport { ToolCallPart } from \"./parts/tool-call\";\n\nexport const chatPlugin = createPlugin({\n name: \"chat\",\n components: {\n \"chat.box\": eagerComponent(ChatBoxComponent),\n \"chat.part.text\": eagerComponent(TextPart),\n \"chat.part.tool-call\": eagerComponent(ToolCallPart),\n },\n});\n"],"mappings":";;;;;AAKA,IAAa,aAAa,aAAa;CACrC,MAAM;CACN,YAAY;EACV,YAAY,eAAe,OAAgB;EAC3C,kBAAkB,eAAe,QAAQ;EACzC,uBAAuB,eAAe,YAAY;CACpD;AACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../resources/js/chat/index.ts"],"sourcesContent":["import { createPlugin, eagerComponent } from \"@lattice-php/lattice/core/registry\";\nimport ChatBoxComponent from \"./components/chat-box\";\nimport { TextPart } from \"./parts/text\";\nimport { ToolCallPart } from \"./parts/tool-call\";\n\nexport const chatComponents = createPlugin({\n name: \"lattice/chat\",\n components: {\n \"chat.box\": eagerComponent(ChatBoxComponent),\n \"chat.part.text\": eagerComponent(TextPart),\n \"chat.part.tool-call\": eagerComponent(ToolCallPart),\n },\n});\n"],"mappings":";;;;;AAKA,IAAa,iBAAiB,aAAa;CACzC,MAAM;CACN,YAAY;EACV,YAAY,eAAe,OAAgB;EAC3C,kBAAkB,eAAe,QAAQ;EACzC,uBAAuB,eAAe,YAAY;CACpD;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { RendererComponent } from '../types';
2
+ declare const ChartView: RendererComponent<"chart">;
3
+ export default ChartView;
@@ -0,0 +1,225 @@
1
+ import { useLocale } from "../../i18n/locale.js";
2
+ import { useTimezone } from "../../i18n/timezone.js";
3
+ import { nodeIdentity } from "../test-id.js";
4
+ import { formatValue } from "../../format/value.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, ComposedChart, Legend, Line, LineChart, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
7
+ //#region resources/js/core/components/chart-view.tsx
8
+ var chartMargin = {
9
+ bottom: 0,
10
+ left: 0,
11
+ right: 16,
12
+ top: 8
13
+ };
14
+ var compactLegendProps = {
15
+ align: "center",
16
+ height: 24,
17
+ iconSize: 7,
18
+ verticalAlign: "top",
19
+ wrapperStyle: {
20
+ fontSize: 11,
21
+ lineHeight: "14px",
22
+ paddingBottom: 6
23
+ }
24
+ };
25
+ var axisTick = { fontSize: 10 };
26
+ var tooltipProps = {
27
+ contentStyle: {
28
+ background: "var(--lt-surface)",
29
+ border: "1px solid var(--lt-border)",
30
+ borderRadius: "var(--lt-radius-sm)",
31
+ boxShadow: "var(--lt-shadow-sm)",
32
+ color: "var(--lt-surface-fg)",
33
+ fontSize: 12
34
+ },
35
+ itemStyle: { color: "var(--lt-surface-fg)" },
36
+ labelStyle: { color: "var(--lt-muted-fg)" }
37
+ };
38
+ var palette = [
39
+ "var(--lt-primary)",
40
+ "var(--lt-success)",
41
+ "var(--lt-info)",
42
+ "var(--lt-warning)",
43
+ "var(--lt-danger)",
44
+ "var(--lt-muted-fg)"
45
+ ];
46
+ function colorAt(index) {
47
+ return palette[index % palette.length] ?? "var(--lt-primary)";
48
+ }
49
+ function isRecord(value) {
50
+ return typeof value === "object" && value !== null && !Array.isArray(value);
51
+ }
52
+ function datumColor(datum, series, index) {
53
+ if (isRecord(datum) && typeof datum.color === "string") return datum.color;
54
+ return series.color ?? colorAt(index);
55
+ }
56
+ function isCartesianSeries(series) {
57
+ return series.type === "area" || series.type === "bar" || series.type === "line";
58
+ }
59
+ function cartesianChartFor(series) {
60
+ const types = new Set(series.map((item) => item.type));
61
+ const firstSeries = series[0];
62
+ if (firstSeries === void 0 || types.size !== 1) return ComposedChart;
63
+ switch (firstSeries.type) {
64
+ case "area": return AreaChart;
65
+ case "bar": return BarChart;
66
+ case "line": return LineChart;
67
+ }
68
+ }
69
+ function ChartFrame({ children, description, id, title }) {
70
+ return /* @__PURE__ */ jsxs("div", {
71
+ className: "flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm",
72
+ "data-lattice-component": id,
73
+ children: [(title !== null || description !== null) && /* @__PURE__ */ jsxs("div", {
74
+ className: "flex min-w-0 flex-col gap-1.5",
75
+ children: [title !== null && /* @__PURE__ */ jsx("div", {
76
+ className: "text-sm font-semibold leading-tight",
77
+ children: title
78
+ }), description !== null && /* @__PURE__ */ jsx("div", {
79
+ className: "text-xs leading-5 text-lt-muted-fg",
80
+ children: description
81
+ })]
82
+ }), children]
83
+ });
84
+ }
85
+ function CartesianChart({ props }) {
86
+ const series = props.series.filter(isCartesianSeries);
87
+ const RechartsChart = cartesianChartFor(series);
88
+ const { locale } = useLocale();
89
+ const { timezone } = useTimezone();
90
+ const ctx = {
91
+ locale,
92
+ timezone
93
+ };
94
+ const formatCategory = (value) => formatValue(value, props.categoryFormat, ctx);
95
+ const formatValueTick = (value) => formatValue(value, props.valueFormat, ctx);
96
+ const tooltipCursor = series.some((item) => item.type === "bar") ? {
97
+ fill: "var(--lt-muted-fg)",
98
+ fillOpacity: .15
99
+ } : {
100
+ stroke: "var(--lt-muted-fg)",
101
+ strokeOpacity: .4
102
+ };
103
+ return /* @__PURE__ */ jsx(ResponsiveContainer, {
104
+ width: "100%",
105
+ height: props.height,
106
+ debounce: 100,
107
+ children: /* @__PURE__ */ jsxs(RechartsChart, {
108
+ data: props.data,
109
+ margin: chartMargin,
110
+ children: [
111
+ props.grid && /* @__PURE__ */ jsx(CartesianGrid, {
112
+ strokeDasharray: "3 3",
113
+ stroke: "var(--lt-border)"
114
+ }),
115
+ props.xAxis && props.categoryKey !== null && /* @__PURE__ */ jsx(XAxis, {
116
+ dataKey: props.categoryKey,
117
+ stroke: "var(--lt-muted-fg)",
118
+ tick: axisTick,
119
+ tickFormatter: formatCategory,
120
+ tickLine: false
121
+ }),
122
+ props.yAxis && /* @__PURE__ */ jsx(YAxis, {
123
+ stroke: "var(--lt-muted-fg)",
124
+ tick: axisTick,
125
+ tickFormatter: formatValueTick,
126
+ tickLine: false,
127
+ width: 42
128
+ }),
129
+ props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
130
+ ...tooltipProps,
131
+ cursor: tooltipCursor,
132
+ formatter: formatValueTick,
133
+ labelFormatter: formatCategory
134
+ }),
135
+ props.legend && /* @__PURE__ */ jsx(Legend, { ...compactLegendProps }),
136
+ series.map((item, index) => {
137
+ const color = item.color ?? colorAt(index);
138
+ const key = `${item.type}:${item.dataKey}`;
139
+ if (item.type === "area") return /* @__PURE__ */ jsx(Area, {
140
+ dataKey: item.dataKey,
141
+ fill: color,
142
+ fillOpacity: .16,
143
+ name: item.name ?? void 0,
144
+ stackId: item.stackId ?? void 0,
145
+ stroke: color,
146
+ type: "monotone"
147
+ }, key);
148
+ if (item.type === "bar") return /* @__PURE__ */ jsx(Bar, {
149
+ dataKey: item.dataKey,
150
+ fill: color,
151
+ name: item.name ?? void 0,
152
+ radius: [
153
+ 4,
154
+ 4,
155
+ 0,
156
+ 0
157
+ ],
158
+ stackId: item.stackId ?? void 0
159
+ }, key);
160
+ return /* @__PURE__ */ jsx(Line, {
161
+ dataKey: item.dataKey,
162
+ dot: false,
163
+ name: item.name ?? void 0,
164
+ stroke: color,
165
+ strokeWidth: 2,
166
+ type: "monotone"
167
+ }, key);
168
+ })
169
+ ]
170
+ })
171
+ });
172
+ }
173
+ function PieChartView({ props, series }) {
174
+ const { locale } = useLocale();
175
+ const { timezone } = useTimezone();
176
+ const ctx = {
177
+ locale,
178
+ timezone
179
+ };
180
+ return /* @__PURE__ */ jsx(ResponsiveContainer, {
181
+ width: "100%",
182
+ height: props.height,
183
+ debounce: 100,
184
+ children: /* @__PURE__ */ jsxs(PieChart, {
185
+ margin: chartMargin,
186
+ children: [
187
+ props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
188
+ ...tooltipProps,
189
+ formatter: (value) => formatValue(value, props.valueFormat, ctx),
190
+ labelFormatter: (value) => formatValue(value, props.categoryFormat, ctx)
191
+ }),
192
+ props.legend && /* @__PURE__ */ jsx(Legend, { ...compactLegendProps }),
193
+ /* @__PURE__ */ jsx(Pie, {
194
+ data: props.data,
195
+ dataKey: series.dataKey,
196
+ name: series.name ?? void 0,
197
+ nameKey: series.nameKey ?? void 0,
198
+ outerRadius: "68%",
199
+ children: props.data.map((datum, index) => /* @__PURE__ */ jsx(Cell, { fill: datumColor(datum, series, index) }, index))
200
+ })
201
+ ]
202
+ })
203
+ });
204
+ }
205
+ var ChartView = ({ node }) => {
206
+ const props = node.props;
207
+ const pieSeries = props.series.find((series) => series.type === "pie");
208
+ const hasCartesianSeries = props.series.some(isCartesianSeries);
209
+ return /* @__PURE__ */ jsx(ChartFrame, {
210
+ description: props.description,
211
+ id: nodeIdentity(node),
212
+ title: props.title,
213
+ children: /* @__PURE__ */ jsx("div", {
214
+ className: "min-h-0 w-full",
215
+ children: pieSeries && !hasCartesianSeries ? /* @__PURE__ */ jsx(PieChartView, {
216
+ props,
217
+ series: pieSeries
218
+ }) : /* @__PURE__ */ jsx(CartesianChart, { props })
219
+ })
220
+ });
221
+ };
222
+ //#endregion
223
+ export { ChartView as default };
224
+
225
+ //# sourceMappingURL=chart-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-view.js","names":[],"sources":["../../../resources/js/core/components/chart-view.tsx"],"sourcesContent":["import {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n ComposedChart,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { PropsOf, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useLocale, useTimezone } from \"@lattice-php/lattice/i18n\";\nimport { formatValue } from \"../../format/value\";\n\ntype ChartProps = PropsOf<\"chart\">;\ntype ChartSeries = ChartProps[\"series\"][number];\ntype ChartDatum = ChartProps[\"data\"][number];\ntype CartesianSeries = ChartSeries & { type: \"area\" | \"bar\" | \"line\" };\ntype ChartMargin = { bottom: number; left: number; right: number; top: number };\ntype CartesianChartComponent = ComponentType<{\n children: ReactNode;\n data: ChartProps[\"data\"];\n margin?: ChartMargin;\n}>;\n\nconst chartMargin: ChartMargin = { bottom: 0, left: 0, right: 16, top: 8 };\nconst compactLegendProps = {\n align: \"center\" as const,\n height: 24,\n iconSize: 7,\n verticalAlign: \"top\" as const,\n wrapperStyle: { fontSize: 11, lineHeight: \"14px\", paddingBottom: 6 },\n};\nconst axisTick = { fontSize: 10 };\nconst tooltipProps = {\n contentStyle: {\n background: \"var(--lt-surface)\",\n border: \"1px solid var(--lt-border)\",\n borderRadius: \"var(--lt-radius-sm)\",\n boxShadow: \"var(--lt-shadow-sm)\",\n color: \"var(--lt-surface-fg)\",\n fontSize: 12,\n },\n itemStyle: { color: \"var(--lt-surface-fg)\" },\n labelStyle: { color: \"var(--lt-muted-fg)\" },\n} as const;\n\nconst palette = [\n \"var(--lt-primary)\",\n \"var(--lt-success)\",\n \"var(--lt-info)\",\n \"var(--lt-warning)\",\n \"var(--lt-danger)\",\n \"var(--lt-muted-fg)\",\n];\n\nfunction colorAt(index: number): string {\n return palette[index % palette.length] ?? \"var(--lt-primary)\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction datumColor(datum: ChartDatum, series: ChartSeries, index: number): string {\n if (isRecord(datum) && typeof datum.color === \"string\") {\n return datum.color;\n }\n\n return series.color ?? colorAt(index);\n}\n\nfunction isCartesianSeries(series: ChartSeries): series is CartesianSeries {\n return series.type === \"area\" || series.type === \"bar\" || series.type === \"line\";\n}\n\nfunction cartesianChartFor(series: CartesianSeries[]): CartesianChartComponent {\n const types = new Set(series.map((item) => item.type));\n const firstSeries = series[0];\n\n if (firstSeries === undefined || types.size !== 1) {\n return ComposedChart;\n }\n\n switch (firstSeries.type) {\n case \"area\":\n return AreaChart;\n case \"bar\":\n return BarChart;\n case \"line\":\n return LineChart;\n }\n}\n\nfunction ChartFrame({\n children,\n description,\n id,\n title,\n}: {\n children: ReactNode;\n description: string | null;\n id?: string;\n title: string | null;\n}) {\n const hasHeader = title !== null || description !== null;\n\n return (\n <div\n className=\"flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={id}\n >\n {hasHeader && (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title !== null && <div className=\"text-sm font-semibold leading-tight\">{title}</div>}\n {description !== null && (\n <div className=\"text-xs leading-5 text-lt-muted-fg\">{description}</div>\n )}\n </div>\n )}\n {children}\n </div>\n );\n}\n\nfunction CartesianChart({ props }: { props: ChartProps }) {\n const series = props.series.filter(isCartesianSeries);\n const RechartsChart = cartesianChartFor(series);\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n const ctx = { locale, timezone };\n const formatCategory = (value: unknown) => formatValue(value, props.categoryFormat, ctx);\n const formatValueTick = (value: unknown) => formatValue(value, props.valueFormat, ctx);\n const hasBarSeries = series.some((item) => item.type === \"bar\");\n const tooltipCursor = hasBarSeries\n ? { fill: \"var(--lt-muted-fg)\", fillOpacity: 0.15 }\n : { stroke: \"var(--lt-muted-fg)\", strokeOpacity: 0.4 };\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <RechartsChart data={props.data} margin={chartMargin}>\n {props.grid && <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--lt-border)\" />}\n {props.xAxis && props.categoryKey !== null && (\n <XAxis\n dataKey={props.categoryKey}\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickFormatter={formatCategory}\n tickLine={false}\n />\n )}\n {props.yAxis && (\n <YAxis\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickFormatter={formatValueTick}\n tickLine={false}\n width={42}\n />\n )}\n {props.tooltip && (\n <Tooltip\n {...tooltipProps}\n cursor={tooltipCursor}\n formatter={formatValueTick}\n labelFormatter={formatCategory}\n />\n )}\n {props.legend && <Legend {...compactLegendProps} />}\n {series.map((item, index) => {\n const color = item.color ?? colorAt(index);\n const key = `${item.type}:${item.dataKey}`;\n\n if (item.type === \"area\") {\n return (\n <Area\n key={key}\n dataKey={item.dataKey}\n fill={color}\n fillOpacity={0.16}\n name={item.name ?? undefined}\n stackId={item.stackId ?? undefined}\n stroke={color}\n type=\"monotone\"\n />\n );\n }\n\n if (item.type === \"bar\") {\n return (\n <Bar\n key={key}\n dataKey={item.dataKey}\n fill={color}\n name={item.name ?? undefined}\n radius={[4, 4, 0, 0]}\n stackId={item.stackId ?? undefined}\n />\n );\n }\n\n return (\n <Line\n key={key}\n dataKey={item.dataKey}\n dot={false}\n name={item.name ?? undefined}\n stroke={color}\n strokeWidth={2}\n type=\"monotone\"\n />\n );\n })}\n </RechartsChart>\n </ResponsiveContainer>\n );\n}\n\nfunction PieChartView({ props, series }: { props: ChartProps; series: ChartSeries }) {\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n const ctx = { locale, timezone };\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <PieChart margin={chartMargin}>\n {props.tooltip && (\n <Tooltip\n {...tooltipProps}\n formatter={(value) => formatValue(value, props.valueFormat, ctx)}\n labelFormatter={(value) => formatValue(value, props.categoryFormat, ctx)}\n />\n )}\n {props.legend && <Legend {...compactLegendProps} />}\n <Pie\n data={props.data}\n dataKey={series.dataKey}\n name={series.name ?? undefined}\n nameKey={series.nameKey ?? undefined}\n outerRadius=\"68%\"\n >\n {props.data.map((datum, index) => (\n <Cell key={index} fill={datumColor(datum, series, index)} />\n ))}\n </Pie>\n </PieChart>\n </ResponsiveContainer>\n );\n}\n\nconst ChartView: RendererComponent<\"chart\"> = ({ node }) => {\n const props = node.props;\n const pieSeries = props.series.find((series) => series.type === \"pie\");\n const hasCartesianSeries = props.series.some(isCartesianSeries);\n\n return (\n <ChartFrame description={props.description} id={nodeIdentity(node)} title={props.title}>\n <div className=\"min-h-0 w-full\">\n {pieSeries && !hasCartesianSeries ? (\n <PieChartView props={props} series={pieSeries} />\n ) : (\n <CartesianChart props={props} />\n )}\n </div>\n </ChartFrame>\n );\n};\n\nexport default ChartView;\n"],"mappings":";;;;;;;AAmCA,IAAM,cAA2B;CAAE,QAAQ;CAAG,MAAM;CAAG,OAAO;CAAI,KAAK;AAAE;AACzE,IAAM,qBAAqB;CACzB,OAAO;CACP,QAAQ;CACR,UAAU;CACV,eAAe;CACf,cAAc;EAAE,UAAU;EAAI,YAAY;EAAQ,eAAe;CAAE;AACrE;AACA,IAAM,WAAW,EAAE,UAAU,GAAG;AAChC,IAAM,eAAe;CACnB,cAAc;EACZ,YAAY;EACZ,QAAQ;EACR,cAAc;EACd,WAAW;EACX,OAAO;EACP,UAAU;CACZ;CACA,WAAW,EAAE,OAAO,uBAAuB;CAC3C,YAAY,EAAE,OAAO,qBAAqB;AAC5C;AAEA,IAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,QAAQ,QAAQ,WAAW;AAC5C;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAW,OAAmB,QAAqB,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224 +1,14 @@
1
- import { useLocale } from "../../i18n/locale.js";
2
- import { useTimezone } from "../../i18n/timezone.js";
3
- import { nodeIdentity } from "../test-id.js";
4
- import { formatValue } from "../../format/value.js";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- import { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, ComposedChart, Legend, Line, LineChart, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
1
+ import { Suspense, lazy } from "react";
2
+ import { jsx } from "react/jsx-runtime";
7
3
  //#region resources/js/core/components/chart.tsx
8
- var chartMargin = {
9
- bottom: 0,
10
- left: 0,
11
- right: 16,
12
- top: 8
13
- };
14
- var compactLegendProps = {
15
- align: "center",
16
- height: 24,
17
- iconSize: 7,
18
- verticalAlign: "top",
19
- wrapperStyle: {
20
- fontSize: 11,
21
- lineHeight: "14px",
22
- paddingBottom: 6
23
- }
24
- };
25
- var axisTick = { fontSize: 10 };
26
- var tooltipProps = {
27
- contentStyle: {
28
- background: "var(--lt-surface)",
29
- border: "1px solid var(--lt-border)",
30
- borderRadius: "var(--lt-radius-sm)",
31
- boxShadow: "var(--lt-shadow-sm)",
32
- color: "var(--lt-surface-fg)",
33
- fontSize: 12
34
- },
35
- itemStyle: { color: "var(--lt-surface-fg)" },
36
- labelStyle: { color: "var(--lt-muted-fg)" }
37
- };
38
- var palette = [
39
- "var(--lt-primary)",
40
- "var(--lt-success)",
41
- "var(--lt-info)",
42
- "var(--lt-warning)",
43
- "var(--lt-danger)",
44
- "var(--lt-muted-fg)"
45
- ];
46
- function colorAt(index) {
47
- return palette[index % palette.length] ?? "var(--lt-primary)";
48
- }
49
- function isRecord(value) {
50
- return typeof value === "object" && value !== null && !Array.isArray(value);
51
- }
52
- function datumColor(datum, series, index) {
53
- if (isRecord(datum) && typeof datum.color === "string") return datum.color;
54
- return series.color ?? colorAt(index);
55
- }
56
- function isCartesianSeries(series) {
57
- return series.type === "area" || series.type === "bar" || series.type === "line";
58
- }
59
- function cartesianChartFor(series) {
60
- const types = new Set(series.map((item) => item.type));
61
- const firstSeries = series[0];
62
- if (firstSeries === void 0 || types.size !== 1) return ComposedChart;
63
- switch (firstSeries.type) {
64
- case "area": return AreaChart;
65
- case "bar": return BarChart;
66
- case "line": return LineChart;
67
- }
68
- }
69
- function ChartFrame({ children, description, id, title }) {
70
- return /* @__PURE__ */ jsxs("div", {
71
- className: "flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm",
72
- "data-lattice-component": id,
73
- children: [(title !== null || description !== null) && /* @__PURE__ */ jsxs("div", {
74
- className: "flex min-w-0 flex-col gap-1.5",
75
- children: [title !== null && /* @__PURE__ */ jsx("div", {
76
- className: "text-sm font-semibold leading-tight",
77
- children: title
78
- }), description !== null && /* @__PURE__ */ jsx("div", {
79
- className: "text-xs leading-5 text-lt-muted-fg",
80
- children: description
81
- })]
82
- }), children]
83
- });
84
- }
85
- function CartesianChart({ props }) {
86
- const series = props.series.filter(isCartesianSeries);
87
- const RechartsChart = cartesianChartFor(series);
88
- const { locale } = useLocale();
89
- const { timezone } = useTimezone();
90
- const ctx = {
91
- locale,
92
- timezone
93
- };
94
- const formatCategory = (value) => formatValue(value, props.categoryFormat, ctx);
95
- const formatValueTick = (value) => formatValue(value, props.valueFormat, ctx);
96
- const tooltipCursor = series.some((item) => item.type === "bar") ? {
97
- fill: "var(--lt-muted-fg)",
98
- fillOpacity: .15
99
- } : {
100
- stroke: "var(--lt-muted-fg)",
101
- strokeOpacity: .4
102
- };
103
- return /* @__PURE__ */ jsx(ResponsiveContainer, {
104
- width: "100%",
105
- height: props.height,
106
- debounce: 100,
107
- children: /* @__PURE__ */ jsxs(RechartsChart, {
108
- data: props.data,
109
- margin: chartMargin,
110
- children: [
111
- props.grid && /* @__PURE__ */ jsx(CartesianGrid, {
112
- strokeDasharray: "3 3",
113
- stroke: "var(--lt-border)"
114
- }),
115
- props.xAxis && props.categoryKey !== null && /* @__PURE__ */ jsx(XAxis, {
116
- dataKey: props.categoryKey,
117
- stroke: "var(--lt-muted-fg)",
118
- tick: axisTick,
119
- tickFormatter: formatCategory,
120
- tickLine: false
121
- }),
122
- props.yAxis && /* @__PURE__ */ jsx(YAxis, {
123
- stroke: "var(--lt-muted-fg)",
124
- tick: axisTick,
125
- tickFormatter: formatValueTick,
126
- tickLine: false,
127
- width: 42
128
- }),
129
- props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
130
- ...tooltipProps,
131
- cursor: tooltipCursor,
132
- formatter: formatValueTick,
133
- labelFormatter: formatCategory
134
- }),
135
- props.legend && /* @__PURE__ */ jsx(Legend, { ...compactLegendProps }),
136
- series.map((item, index) => {
137
- const color = item.color ?? colorAt(index);
138
- const key = `${item.type}:${item.dataKey}`;
139
- if (item.type === "area") return /* @__PURE__ */ jsx(Area, {
140
- dataKey: item.dataKey,
141
- fill: color,
142
- fillOpacity: .16,
143
- name: item.name ?? void 0,
144
- stackId: item.stackId ?? void 0,
145
- stroke: color,
146
- type: "monotone"
147
- }, key);
148
- if (item.type === "bar") return /* @__PURE__ */ jsx(Bar, {
149
- dataKey: item.dataKey,
150
- fill: color,
151
- name: item.name ?? void 0,
152
- radius: [
153
- 4,
154
- 4,
155
- 0,
156
- 0
157
- ],
158
- stackId: item.stackId ?? void 0
159
- }, key);
160
- return /* @__PURE__ */ jsx(Line, {
161
- dataKey: item.dataKey,
162
- dot: false,
163
- name: item.name ?? void 0,
164
- stroke: color,
165
- strokeWidth: 2,
166
- type: "monotone"
167
- }, key);
168
- })
169
- ]
170
- })
171
- });
172
- }
173
- function PieChartView({ props, series }) {
174
- const { locale } = useLocale();
175
- const { timezone } = useTimezone();
176
- const ctx = {
177
- locale,
178
- timezone
179
- };
180
- return /* @__PURE__ */ jsx(ResponsiveContainer, {
181
- width: "100%",
182
- height: props.height,
183
- debounce: 100,
184
- children: /* @__PURE__ */ jsxs(PieChart, {
185
- margin: chartMargin,
186
- children: [
187
- props.tooltip && /* @__PURE__ */ jsx(Tooltip, {
188
- ...tooltipProps,
189
- formatter: (value) => formatValue(value, props.valueFormat, ctx),
190
- labelFormatter: (value) => formatValue(value, props.categoryFormat, ctx)
191
- }),
192
- props.legend && /* @__PURE__ */ jsx(Legend, { ...compactLegendProps }),
193
- /* @__PURE__ */ jsx(Pie, {
194
- data: props.data,
195
- dataKey: series.dataKey,
196
- name: series.name ?? void 0,
197
- nameKey: series.nameKey ?? void 0,
198
- outerRadius: "68%",
199
- children: props.data.map((datum, index) => /* @__PURE__ */ jsx(Cell, { fill: datumColor(datum, series, index) }, index))
200
- })
201
- ]
202
- })
203
- });
204
- }
205
- var ChartComponent = ({ node }) => {
206
- const props = node.props;
207
- const pieSeries = props.series.find((series) => series.type === "pie");
208
- const hasCartesianSeries = props.series.some(isCartesianSeries);
209
- return /* @__PURE__ */ jsx(ChartFrame, {
210
- description: props.description,
211
- id: nodeIdentity(node),
212
- title: props.title,
213
- children: /* @__PURE__ */ jsx("div", {
214
- className: "min-h-0 w-full",
215
- children: pieSeries && !hasCartesianSeries ? /* @__PURE__ */ jsx(PieChartView, {
216
- props,
217
- series: pieSeries
218
- }) : /* @__PURE__ */ jsx(CartesianChart, { props })
219
- })
220
- });
221
- };
4
+ var ChartView = lazy(() => import("./chart-view.js"));
5
+ var ChartComponent = ({ children, node }) => /* @__PURE__ */ jsx(Suspense, {
6
+ fallback: null,
7
+ children: /* @__PURE__ */ jsx(ChartView, {
8
+ node,
9
+ children
10
+ })
11
+ });
222
12
  //#endregion
223
13
  export { ChartComponent as default };
224
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"chart.js","names":[],"sources":["../../../resources/js/core/components/chart.tsx"],"sourcesContent":["import {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n ComposedChart,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport type { PropsOf, RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useLocale, useTimezone } from \"@lattice-php/lattice/i18n\";\nimport { formatValue } from \"../../format/value\";\n\ntype ChartProps = PropsOf<\"chart\">;\ntype ChartSeries = ChartProps[\"series\"][number];\ntype ChartDatum = ChartProps[\"data\"][number];\ntype CartesianSeries = ChartSeries & { type: \"area\" | \"bar\" | \"line\" };\ntype ChartMargin = { bottom: number; left: number; right: number; top: number };\ntype CartesianChartComponent = ComponentType<{\n children: ReactNode;\n data: ChartProps[\"data\"];\n margin?: ChartMargin;\n}>;\n\nconst chartMargin: ChartMargin = { bottom: 0, left: 0, right: 16, top: 8 };\nconst compactLegendProps = {\n align: \"center\" as const,\n height: 24,\n iconSize: 7,\n verticalAlign: \"top\" as const,\n wrapperStyle: { fontSize: 11, lineHeight: \"14px\", paddingBottom: 6 },\n};\nconst axisTick = { fontSize: 10 };\nconst tooltipProps = {\n contentStyle: {\n background: \"var(--lt-surface)\",\n border: \"1px solid var(--lt-border)\",\n borderRadius: \"var(--lt-radius-sm)\",\n boxShadow: \"var(--lt-shadow-sm)\",\n color: \"var(--lt-surface-fg)\",\n fontSize: 12,\n },\n itemStyle: { color: \"var(--lt-surface-fg)\" },\n labelStyle: { color: \"var(--lt-muted-fg)\" },\n} as const;\n\nconst palette = [\n \"var(--lt-primary)\",\n \"var(--lt-success)\",\n \"var(--lt-info)\",\n \"var(--lt-warning)\",\n \"var(--lt-danger)\",\n \"var(--lt-muted-fg)\",\n];\n\nfunction colorAt(index: number): string {\n return palette[index % palette.length] ?? \"var(--lt-primary)\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction datumColor(datum: ChartDatum, series: ChartSeries, index: number): string {\n if (isRecord(datum) && typeof datum.color === \"string\") {\n return datum.color;\n }\n\n return series.color ?? colorAt(index);\n}\n\nfunction isCartesianSeries(series: ChartSeries): series is CartesianSeries {\n return series.type === \"area\" || series.type === \"bar\" || series.type === \"line\";\n}\n\nfunction cartesianChartFor(series: CartesianSeries[]): CartesianChartComponent {\n const types = new Set(series.map((item) => item.type));\n const firstSeries = series[0];\n\n if (firstSeries === undefined || types.size !== 1) {\n return ComposedChart;\n }\n\n switch (firstSeries.type) {\n case \"area\":\n return AreaChart;\n case \"bar\":\n return BarChart;\n case \"line\":\n return LineChart;\n }\n}\n\nfunction ChartFrame({\n children,\n description,\n id,\n title,\n}: {\n children: ReactNode;\n description: string | null;\n id?: string;\n title: string | null;\n}) {\n const hasHeader = title !== null || description !== null;\n\n return (\n <div\n className=\"flex flex-col gap-3 rounded-lt border border-lt-border bg-lt-surface p-4 text-lt-surface-fg shadow-lt-sm\"\n data-lattice-component={id}\n >\n {hasHeader && (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {title !== null && <div className=\"text-sm font-semibold leading-tight\">{title}</div>}\n {description !== null && (\n <div className=\"text-xs leading-5 text-lt-muted-fg\">{description}</div>\n )}\n </div>\n )}\n {children}\n </div>\n );\n}\n\nfunction CartesianChart({ props }: { props: ChartProps }) {\n const series = props.series.filter(isCartesianSeries);\n const RechartsChart = cartesianChartFor(series);\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n const ctx = { locale, timezone };\n const formatCategory = (value: unknown) => formatValue(value, props.categoryFormat, ctx);\n const formatValueTick = (value: unknown) => formatValue(value, props.valueFormat, ctx);\n const hasBarSeries = series.some((item) => item.type === \"bar\");\n const tooltipCursor = hasBarSeries\n ? { fill: \"var(--lt-muted-fg)\", fillOpacity: 0.15 }\n : { stroke: \"var(--lt-muted-fg)\", strokeOpacity: 0.4 };\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <RechartsChart data={props.data} margin={chartMargin}>\n {props.grid && <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--lt-border)\" />}\n {props.xAxis && props.categoryKey !== null && (\n <XAxis\n dataKey={props.categoryKey}\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickFormatter={formatCategory}\n tickLine={false}\n />\n )}\n {props.yAxis && (\n <YAxis\n stroke=\"var(--lt-muted-fg)\"\n tick={axisTick}\n tickFormatter={formatValueTick}\n tickLine={false}\n width={42}\n />\n )}\n {props.tooltip && (\n <Tooltip\n {...tooltipProps}\n cursor={tooltipCursor}\n formatter={formatValueTick}\n labelFormatter={formatCategory}\n />\n )}\n {props.legend && <Legend {...compactLegendProps} />}\n {series.map((item, index) => {\n const color = item.color ?? colorAt(index);\n const key = `${item.type}:${item.dataKey}`;\n\n if (item.type === \"area\") {\n return (\n <Area\n key={key}\n dataKey={item.dataKey}\n fill={color}\n fillOpacity={0.16}\n name={item.name ?? undefined}\n stackId={item.stackId ?? undefined}\n stroke={color}\n type=\"monotone\"\n />\n );\n }\n\n if (item.type === \"bar\") {\n return (\n <Bar\n key={key}\n dataKey={item.dataKey}\n fill={color}\n name={item.name ?? undefined}\n radius={[4, 4, 0, 0]}\n stackId={item.stackId ?? undefined}\n />\n );\n }\n\n return (\n <Line\n key={key}\n dataKey={item.dataKey}\n dot={false}\n name={item.name ?? undefined}\n stroke={color}\n strokeWidth={2}\n type=\"monotone\"\n />\n );\n })}\n </RechartsChart>\n </ResponsiveContainer>\n );\n}\n\nfunction PieChartView({ props, series }: { props: ChartProps; series: ChartSeries }) {\n const { locale } = useLocale();\n const { timezone } = useTimezone();\n const ctx = { locale, timezone };\n\n return (\n <ResponsiveContainer width=\"100%\" height={props.height} debounce={100}>\n <PieChart margin={chartMargin}>\n {props.tooltip && (\n <Tooltip\n {...tooltipProps}\n formatter={(value) => formatValue(value, props.valueFormat, ctx)}\n labelFormatter={(value) => formatValue(value, props.categoryFormat, ctx)}\n />\n )}\n {props.legend && <Legend {...compactLegendProps} />}\n <Pie\n data={props.data}\n dataKey={series.dataKey}\n name={series.name ?? undefined}\n nameKey={series.nameKey ?? undefined}\n outerRadius=\"68%\"\n >\n {props.data.map((datum, index) => (\n <Cell key={index} fill={datumColor(datum, series, index)} />\n ))}\n </Pie>\n </PieChart>\n </ResponsiveContainer>\n );\n}\n\nconst ChartComponent: RendererComponent<\"chart\"> = ({ node }) => {\n const props = node.props;\n const pieSeries = props.series.find((series) => series.type === \"pie\");\n const hasCartesianSeries = props.series.some(isCartesianSeries);\n\n return (\n <ChartFrame description={props.description} id={nodeIdentity(node)} title={props.title}>\n <div className=\"min-h-0 w-full\">\n {pieSeries && !hasCartesianSeries ? (\n <PieChartView props={props} series={pieSeries} />\n ) : (\n <CartesianChart props={props} />\n )}\n </div>\n </ChartFrame>\n );\n};\n\nexport default ChartComponent;\n"],"mappings":";;;;;;;AAmCA,IAAM,cAA2B;CAAE,QAAQ;CAAG,MAAM;CAAG,OAAO;CAAI,KAAK;AAAE;AACzE,IAAM,qBAAqB;CACzB,OAAO;CACP,QAAQ;CACR,UAAU;CACV,eAAe;CACf,cAAc;EAAE,UAAU;EAAI,YAAY;EAAQ,eAAe;CAAE;AACrE;AACA,IAAM,WAAW,EAAE,UAAU,GAAG;AAChC,IAAM,eAAe;CACnB,cAAc;EACZ,YAAY;EACZ,QAAQ;EACR,cAAc;EACd,WAAW;EACX,OAAO;EACP,UAAU;CACZ;CACA,WAAW,EAAE,OAAO,uBAAuB;CAC3C,YAAY,EAAE,OAAO,qBAAqB;AAC5C;AAEA,IAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,QAAQ,QAAQ,WAAW;AAC5C;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAW,OAAmB,QAAqB,OAAuB;CACjF,IAAI,SAAS,KAAK,KAAK,OAAO,MAAM,UAAU,UAC5C,OAAO,MAAM;CAGf,OAAO,OAAO,SAAS,QAAQ,KAAK;AACtC;AAEA,SAAS,kBAA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M,EAAE,aAAa,YAAY;CACjC,MAAM,MAAM;EAAE;EAAQ;CAAS;CAE/B,OACE,oBAAC,qBAAD;EAAqB,OAAM;EAAO,QAAQ,MAAM;EAAQ,UAAU;YAChE,qBAAC,UAAD;GAAU,QAAQ;aAAlB;IACG,MAAM,WACL,oBAAC,SAAD;KACE,GAAI;KACJ,YAAY,UAAU,YAAY,OAAO,MAAM,aAAa,GAAG;KAC/D,iBAAiB,UAAU,YAAY,OAAO,MAAM,gBAAgB,GAAG;IACxE,CAAA;IAEF,MAAM,UAAU,oBAAC,QAAD,EAAQ,GAAI,mBAAqB,CAAA;IAClD,oBAAC,KAAD;KACE,MAAM,MAAM;KACZ,SAAS,OAAO;KAChB,MAAM,OAAO,QAAQ,KAAA;KACrB,SAAS,OAAO,WAAW,KAAA;KAC3B,aAAY;eAEX,MAAM,KAAK,KAAK,OAAO,UACtB,oBAAC,MAAD,EAAkB,MAAM,WAAW,OAAO,QAAQ,KAAK,EAAI,GAAhD,KAAgD,CAC5D;IACE,CAAA;GACG;;CACS,CAAA;AAEzB;AAEA,IAAM,kBAA8C,EAAE,WAAW;CAC/D,MAAM,QAAQ,KAAK;CACnB,MAAM,YAAY,MAAM,OAAO,MAAM,WAAW,OAAO,SAAS,KAAK;CACrE,MAAM,qBAAqB,MAAM,OAAO,KAAK,iBAAiB;CAE9D,OACE,oBAAC,YAAD;EAAY,aAAa,MAAM;EAAa,IAAI,aAAa,IAAI;EAAG,OAAO,MAAM;YAC/E,oBAAC,OAAD;GAAK,WAAU;aACZ,aAAa,CAAC,qBACb,oBAAC,cAAD;IAAqB;IAAO,QAAQ;GAAY,CAAA,IAEhD,oBAAC,gBAAD,EAAuB,MAAQ,CAAA;EAE9B,CAAA;CACK,CAAA;AAEhB"}
1
+ {"version":3,"file":"chart.js","names":[],"sources":["../../../resources/js/core/components/chart.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport type { RendererComponent, RendererComponentModule } from \"@lattice-php/lattice/core/types\";\n\nconst ChartView = lazy(() => import(\"./chart-view\") as unknown as Promise<RendererComponentModule>);\n\nconst ChartComponent: RendererComponent<\"chart\"> = ({ children, node }) => (\n <Suspense fallback={null}>\n <ChartView node={node}>{children}</ChartView>\n </Suspense>\n);\n\nexport default ChartComponent;\n"],"mappings":";;;AAGA,IAAM,YAAY,WAAW,OAAO,kBAA8D;AAElG,IAAM,kBAA8C,EAAE,UAAU,WAC9D,oBAAC,UAAD;CAAU,UAAU;WAClB,oBAAC,WAAD;EAAiB;EAAO;CAAoB,CAAA;AACpC,CAAA"}
@@ -1,7 +1,8 @@
1
- import { createPlugin, eagerComponent, lazyComponent } from "../registry.js";
1
+ import { createPlugin, eagerComponent } from "../registry.js";
2
2
  import ButtonComponent from "./button.js";
3
3
  import BadgeComponent from "./badge.js";
4
4
  import CardComponent from "./card.js";
5
+ import ChartComponent from "./chart.js";
5
6
  import CollapsibleComponent from "./collapsible.js";
6
7
  import FloatingPanelComponent from "./floating-panel.js";
7
8
  import FragmentComponent from "./fragment.js";
@@ -23,7 +24,7 @@ var coreComponents = createPlugin({
23
24
  badge: eagerComponent(BadgeComponent),
24
25
  button: eagerComponent(ButtonComponent),
25
26
  card: eagerComponent(CardComponent),
26
- chart: lazyComponent(() => import("./chart.js")),
27
+ chart: eagerComponent(ChartComponent),
27
28
  collapsible: eagerComponent(CollapsibleComponent),
28
29
  "floating-panel": eagerComponent(FloatingPanelComponent),
29
30
  fragment: eagerComponent(FragmentComponent),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../resources/js/core/components/index.ts"],"sourcesContent":["import { createPlugin, eagerComponent, lazyComponent } from \"@lattice-php/lattice/core/registry\";\nimport type { RendererComponentModule } from \"@lattice-php/lattice/core/types\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\nimport TooltipComponent from \"./tooltip\";\n\nexport const coreComponents = createPlugin({\n components: {\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: lazyComponent(\n () => import(\"./chart\") as unknown as Promise<RendererComponentModule<\"chart\">>,\n ),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n tooltip: eagerComponent(TooltipComponent),\n },\n name: \"lattice/core\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,iBAAiB,aAAa;CACzC,YAAY;EACV,OAAO,eAAe,cAAc;EACpC,QAAQ,eAAe,eAAe;EACtC,MAAM,eAAe,aAAa;EAClC,OAAO,oBACC,OAAO,aACf;EACA,aAAa,eAAe,oBAAoB;EAChD,kBAAkB,eAAe,sBAAsB;EACvD,UAAU,eAAe,iBAAiB;EAC1C,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;EACxC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,iBAAiB;EAC7C,SAAS,eAAe,gBAAgB;EACxC,qBAAqB,eAAe,yBAAyB;EAC7D,OAAO,eAAe,cAAc;EACpC,KAAK,eAAe,YAAY;EAChC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;CAC1C;CACA,MAAM;AACR,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../resources/js/core/components/index.ts"],"sourcesContent":["import { createPlugin, eagerComponent } from \"@lattice-php/lattice/core/registry\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport ChartComponent from \"./chart\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\nimport TooltipComponent from \"./tooltip\";\n\nexport const coreComponents = createPlugin({\n components: {\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: eagerComponent(ChartComponent),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n tooltip: eagerComponent(TooltipComponent),\n },\n name: \"lattice/core\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,iBAAiB,aAAa;CACzC,YAAY;EACV,OAAO,eAAe,cAAc;EACpC,QAAQ,eAAe,eAAe;EACtC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,oBAAoB;EAChD,kBAAkB,eAAe,sBAAsB;EACvD,UAAU,eAAe,iBAAiB;EAC1C,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;EACxC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,iBAAiB;EAC7C,SAAS,eAAe,gBAAgB;EACxC,qBAAqB,eAAe,yBAAyB;EAC7D,OAAO,eAAe,cAAc;EACpC,KAAK,eAAe,YAAY;EAChC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;CAC1C;CACA,MAAM;AACR,CAAC"}
@@ -3,7 +3,7 @@ import { extendRegistry } from "./core/registry.js";
3
3
  import { setDefaultRegistry } from "./core/registry-context.js";
4
4
  import { createLayoutResolver, createPageResolver } from "./inertia.js";
5
5
  import { ProviderBase } from "./provider-base.js";
6
- import { lazyRegistry } from "./registry/lazy.js";
6
+ import { registry } from "./registry.js";
7
7
  import { createInertiaApp } from "@inertiajs/react";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  //#region resources/js/create-app.tsx
@@ -13,8 +13,8 @@ import { jsx } from "react/jsx-runtime";
13
13
  * registry, sprite, flash toasts via Lattice's own Toaster — and theme
14
14
  * initialization. Forwards any other createInertiaApp option.
15
15
  */
16
- function createLatticeApp({ registry, plugins, sprite, pages = {}, defaultLayout, strictMode = true, ...inertiaOptions } = {}) {
17
- const baseRegistry = registry ?? lazyRegistry;
16
+ function createLatticeApp({ registry: registry$1, plugins, sprite, pages = {}, defaultLayout, strictMode = true, ...inertiaOptions } = {}) {
17
+ const baseRegistry = registry$1 ?? registry;
18
18
  const activeRegistry = plugins && plugins.length > 0 ? extendRegistry(baseRegistry, ...plugins) : baseRegistry;
19
19
  setDefaultRegistry(activeRegistry);
20
20
  const app = createInertiaApp({
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.js","names":[],"sources":["../resources/js/create-app.tsx"],"sourcesContent":["import { createInertiaApp } from \"@inertiajs/react\";\nimport type { ReactElement } from \"react\";\nimport { initializeTheme } from \"./appearance\";\nimport { extendRegistry, type Plugin, type Registry } from \"./core/registry\";\nimport { setDefaultRegistry } from \"./core/registry-context\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport {\n createLayoutResolver,\n createPageResolver,\n type CreateLayoutResolverOptions,\n type PageModules,\n} from \"./inertia\";\nimport { ProviderBase } from \"./provider-base\";\nimport { registry as defaultRegistry } from \"./registry\";\n\ntype InertiaAppOptions = NonNullable<Parameters<typeof createInertiaApp>[0]>;\n\nexport type CreateLatticeAppOptions = Omit<\n InertiaAppOptions,\n \"resolve\" | \"layout\" | \"setup\" | \"withApp\" | \"pages\"\n> & {\n registry?: Registry;\n /**\n * Component-package plugins to merge onto the registry — pass the\n * Composer-discovered `virtual:lattice/plugins` here to register vendor\n * components with no manual `extendRegistry` call.\n */\n plugins?: Plugin[];\n sprite?: SpriteValue;\n /** Normal Inertia page modules, e.g. `import.meta.glob('./pages/**\\/*.tsx')`. */\n pages?: PageModules;\n defaultLayout?: CreateLayoutResolverOptions[\"defaultLayout\"];\n};\n\n/**\n * Bootstrap an Inertia app with the Lattice shell: the page/layout resolvers\n * (server-driven Lattice pages and normal Inertia pages alike), the Provider —\n * registry, sprite, flash toasts via Lattice's own Toaster — and theme\n * initialization. Forwards any other createInertiaApp option.\n */\nexport function createLatticeApp({\n registry,\n plugins,\n sprite,\n pages = {},\n defaultLayout,\n strictMode = true,\n ...inertiaOptions\n}: CreateLatticeAppOptions = {}) {\n const baseRegistry = registry ?? defaultRegistry;\n const activeRegistry =\n plugins && plugins.length > 0 ? extendRegistry(baseRegistry, ...plugins) : baseRegistry;\n\n setDefaultRegistry(activeRegistry);\n\n const app = createInertiaApp({\n ...inertiaOptions,\n strictMode,\n resolve: createPageResolver(pages),\n layout: createLayoutResolver({ defaultLayout }),\n withApp: (node: ReactElement): ReactElement => (\n <ProviderBase registry={activeRegistry} sprite={sprite}>\n {node}\n </ProviderBase>\n ),\n });\n\n initializeTheme();\n\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,SAAgB,iBAAiB,EAC/B,UACA,SACA,QACA,QAAQ,CAAC,GACT,eACA,aAAa,MACb,GAAG,mBACwB,CAAC,GAAG;CAC/B,MAAM,eAAe,YAAY;CACjC,MAAM,iBACJ,WAAW,QAAQ,SAAS,IAAI,eAAe,cAAc,GAAG,OAAO,IAAI;CAE7E,mBAAmB,cAAc;CAEjC,MAAM,MAAM,iBAAiB;EAC3B,GAAG;EACH;EACA,SAAS,mBAAmB,KAAK;EACjC,QAAQ,qBAAqB,EAAE,cAAc,CAAC;EAC9C,UAAU,SACR,oBAAC,cAAD;GAAc,UAAU;GAAwB;aAC7C;EACW,CAAA;CAElB,CAAC;CAED,gBAAgB;CAEhB,OAAO;AACT"}
1
+ {"version":3,"file":"create-app.js","names":[],"sources":["../resources/js/create-app.tsx"],"sourcesContent":["import { createInertiaApp } from \"@inertiajs/react\";\nimport type { ReactElement } from \"react\";\nimport { initializeTheme } from \"./appearance\";\nimport { extendRegistry, type Plugin, type Registry } from \"./core/registry\";\nimport { setDefaultRegistry } from \"./core/registry-context\";\nimport type { SpriteValue } from \"./icons/sprite\";\nimport {\n createLayoutResolver,\n createPageResolver,\n type CreateLayoutResolverOptions,\n type PageModules,\n} from \"./inertia\";\nimport { ProviderBase } from \"./provider-base\";\nimport { registry as defaultRegistry } from \"./registry\";\n\ntype InertiaAppOptions = NonNullable<Parameters<typeof createInertiaApp>[0]>;\n\nexport type CreateLatticeAppOptions = Omit<\n InertiaAppOptions,\n \"resolve\" | \"layout\" | \"setup\" | \"withApp\" | \"pages\"\n> & {\n registry?: Registry;\n /**\n * Component-package plugins to merge onto the registry — pass the\n * Composer-discovered `virtual:lattice/plugins` here to register vendor\n * components with no manual `extendRegistry` call.\n */\n plugins?: Plugin[];\n sprite?: SpriteValue;\n /** Normal Inertia page modules, e.g. `import.meta.glob('./pages/**\\/*.tsx')`. */\n pages?: PageModules;\n defaultLayout?: CreateLayoutResolverOptions[\"defaultLayout\"];\n};\n\n/**\n * Bootstrap an Inertia app with the Lattice shell: the page/layout resolvers\n * (server-driven Lattice pages and normal Inertia pages alike), the Provider —\n * registry, sprite, flash toasts via Lattice's own Toaster — and theme\n * initialization. Forwards any other createInertiaApp option.\n */\nexport function createLatticeApp({\n registry,\n plugins,\n sprite,\n pages = {},\n defaultLayout,\n strictMode = true,\n ...inertiaOptions\n}: CreateLatticeAppOptions = {}) {\n const baseRegistry = registry ?? defaultRegistry;\n const activeRegistry =\n plugins && plugins.length > 0 ? extendRegistry(baseRegistry, ...plugins) : baseRegistry;\n\n setDefaultRegistry(activeRegistry);\n\n const app = createInertiaApp({\n ...inertiaOptions,\n strictMode,\n resolve: createPageResolver(pages),\n layout: createLayoutResolver({ defaultLayout }),\n withApp: (node: ReactElement): ReactElement => (\n <ProviderBase registry={activeRegistry} sprite={sprite}>\n {node}\n </ProviderBase>\n ),\n });\n\n initializeTheme();\n\n return app;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,SAAgB,iBAAiB,EAC/B,UAAA,YACA,SACA,QACA,QAAQ,CAAC,GACT,eACA,aAAa,MACb,GAAG,mBACwB,CAAC,GAAG;CAC/B,MAAM,eAAe,cAAY;CACjC,MAAM,iBACJ,WAAW,QAAQ,SAAS,IAAI,eAAe,cAAc,GAAG,OAAO,IAAI;CAE7E,mBAAmB,cAAc;CAEjC,MAAM,MAAM,iBAAiB;EAC3B,GAAG;EACH;EACA,SAAS,mBAAmB,KAAK;EACjC,QAAQ,qBAAqB,EAAE,cAAc,CAAC;EAC9C,UAAU,SACR,oBAAC,cAAD;GAAc,UAAU;GAAwB;aAC7C;EACW,CAAA;CAElB,CAAC;CAED,gBAAgB;CAEhB,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { LazyDatePickerControl } from "./lazy-date-picker-control.js";
1
+ import { DatePicker } from "./date-picker.js";
2
2
  import { SimpleField } from "./simple-field.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region resources/js/form/components/fields/date-input.tsx
@@ -7,7 +7,7 @@ var DateInputComponent = ({ node }) => {
7
7
  return /* @__PURE__ */ jsx(SimpleField, {
8
8
  node,
9
9
  label: props.label ?? "",
10
- children: ({ name, testId, value, readOnly, disabled, change, blur }) => /* @__PURE__ */ jsx(LazyDatePickerControl, {
10
+ children: ({ name, testId, value, readOnly, disabled, change, blur }) => /* @__PURE__ */ jsx(DatePicker, {
11
11
  autoFocus: props.autoFocus ?? false,
12
12
  disabled,
13
13
  label: props.label ?? props.name,