@conuti-das/prince-ui 0.9.3

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/index.js ADDED
@@ -0,0 +1,3439 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { UNSTABLE_ToastQueue, Button as Button$1, TextField as TextField$1, Label, Input, Text, FieldError, SearchField as SearchField$1, Checkbox as Checkbox$1, Switch as Switch$1, Select as Select$1, SelectValue, Popover, ListBox, ListBoxItem, ModalOverlay, Modal as Modal$1, Dialog, Heading, MenuTrigger, Menu as Menu$1, MenuItem as MenuItem$1, TooltipTrigger, Tooltip as Tooltip$1, OverlayArrow, ToggleButtonGroup, ToggleButton, Tabs as Tabs$1, TabList, Tab as Tab$1, TabPanel as TabPanel$1, DialogTrigger, RadioGroup as RadioGroup$1, Radio as Radio$1, CheckboxGroup as CheckboxGroup$1, NumberField as NumberField$1, Group, Slider as Slider$1, SliderOutput, SliderTrack, SliderThumb, ComboBox as ComboBox$1, Form as Form$1, GridList as GridList$1, GridListItem as GridListItem$1, TagGroup as TagGroup$1, TagList, Tag as Tag$1, Breadcrumbs as Breadcrumbs$1, Breadcrumb as Breadcrumb$1, Link as Link$1, Disclosure as Disclosure$1, DisclosurePanel, DisclosureGroup as DisclosureGroup$1, Tree as Tree$1, TreeItem as TreeItem$1, TreeItemContent, Table as Table$1, useTableOptions, TableHeader as TableHeader$1, Column as Column$1, TableBody as TableBody$1, Row as Row$1, Cell as Cell$1, DateField as DateField$1, DateInput, DateSegment, TimeField as TimeField$1, Calendar as Calendar$1, RangeCalendar as RangeCalendar$1, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, ColorField as ColorField$1, ColorSwatch as ColorSwatch$1, ColorSwatchPicker as ColorSwatchPicker$1, ColorSwatchPickerItem as ColorSwatchPickerItem$1, ColorArea as ColorArea$1, ColorThumb, ColorSlider as ColorSlider$1, ColorWheel as ColorWheel$1, ColorWheelTrack, ColorPicker as ColorPicker$1, ProgressBar as ProgressBar$1, Meter as Meter$1, Separator as Separator$1, UNSTABLE_ToastRegion, UNSTABLE_Toast, UNSTABLE_ToastContent, DropZone as DropZone$1, FileTrigger as FileTrigger$1, useDragAndDrop, DropIndicator, CalendarGrid, CalendarGridHeader, CalendarHeaderCell, CalendarGridBody, CalendarCell } from 'react-aria-components';
3
+ export { DialogTrigger, parseColor } from 'react-aria-components';
4
+ import { forwardRef, useId, useMemo, Children, isValidElement, useState, useEffect, useRef, useCallback, useImperativeHandle } from 'react';
5
+ import { getFilteredRowModel, getExpandedRowModel, getGroupedRowModel, getSortedRowModel, getCoreRowModel, useReactTable, flexRender } from '@tanstack/react-table';
6
+ import { useVirtualizer } from '@tanstack/react-virtual';
7
+
8
+ // src/utils.ts
9
+ function cx(...parts) {
10
+ return parts.filter(Boolean).join(" ");
11
+ }
12
+ var PATHS = {
13
+ heart: /* @__PURE__ */ jsx("path", { d: "M19 14c1.5-1.6 3-3.4 3-5.6A4.4 4.4 0 0 0 12 5 4.4 4.4 0 0 0 2 8.4c0 2.2 1.5 4 3 5.6l7 7Z" }),
14
+ flame: /* @__PURE__ */ jsx("path", { d: "M8.5 14.5A4 4 0 1 0 16 17c0-1.5-.6-2.6-1.6-3.6-.5 1-1.1 1.5-2.1 1.5 1-2 .4-4.2-1.6-6.2-.4 2-1.4 3-2.8 4.4-.9 1-1.4 2.4-1.4 3.4Z" }),
15
+ moon: /* @__PURE__ */ jsx("path", { d: "M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z" }),
16
+ chart: /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsx("path", { d: "M3 3v18h18" }),
18
+ /* @__PURE__ */ jsx("path", { d: "M7 16v-4M12 16V9M17 16V6" })
19
+ ] }),
20
+ settings: /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
22
+ /* @__PURE__ */ jsx("path", { d: "M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1" })
23
+ ] }),
24
+ menu: /* @__PURE__ */ jsx("path", { d: "M3 6h18M3 12h18M3 18h18" }),
25
+ pin: /* @__PURE__ */ jsxs(Fragment, { children: [
26
+ /* @__PURE__ */ jsx("path", { d: "M12 17v5" }),
27
+ /* @__PURE__ */ jsx("path", { d: "M9 3h6l-1 7 2.5 4h-9L10 10 9 3Z" })
28
+ ] }),
29
+ "pin-off": /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ /* @__PURE__ */ jsx("path", { d: "M12 17v5" }),
31
+ /* @__PURE__ */ jsx("path", { d: "M9 3h6l-1 7 2.5 4h-9L10 10 9 3Z" }),
32
+ /* @__PURE__ */ jsx("path", { d: "M3 3l18 18" })
33
+ ] }),
34
+ user: /* @__PURE__ */ jsxs(Fragment, { children: [
35
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "8", r: "4" }),
36
+ /* @__PURE__ */ jsx("path", { d: "M4 21a8 8 0 0 1 16 0" })
37
+ ] }),
38
+ building: /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ /* @__PURE__ */ jsx("rect", { x: "5", y: "3", width: "14", height: "18", rx: "1" }),
40
+ /* @__PURE__ */ jsx("path", { d: "M9 7h2M13 7h2M9 11h2M13 11h2M10 21v-3h4v3" })
41
+ ] }),
42
+ search: /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
44
+ /* @__PURE__ */ jsx("path", { d: "M21 21l-4.3-4.3" })
45
+ ] }),
46
+ plus: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14" }),
47
+ bolt: /* @__PURE__ */ jsx("path", { d: "M13 2 4 14h7l-1 8 9-12h-7l1-8Z" }),
48
+ alert: /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ /* @__PURE__ */ jsx("path", { d: "M12 3 2 20h20L12 3Z" }),
50
+ /* @__PURE__ */ jsx("path", { d: "M12 9v5M12 17h.01" })
51
+ ] }),
52
+ inbox: /* @__PURE__ */ jsxs(Fragment, { children: [
53
+ /* @__PURE__ */ jsx("path", { d: "M4 4h16l2 8v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6Z" }),
54
+ /* @__PURE__ */ jsx("path", { d: "M2 12h6l2 3h4l2-3h6" })
55
+ ] }),
56
+ compass: /* @__PURE__ */ jsxs(Fragment, { children: [
57
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
58
+ /* @__PURE__ */ jsx("path", { d: "m16 8-2.5 5.5L8 16l2.5-5.5L16 8Z" })
59
+ ] }),
60
+ mail: /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
62
+ /* @__PURE__ */ jsx("path", { d: "m3 7 9 6 9-6" })
63
+ ] }),
64
+ bell: /* @__PURE__ */ jsxs(Fragment, { children: [
65
+ /* @__PURE__ */ jsx("path", { d: "M18 8a6 6 0 1 0-12 0c0 7-3 9-3 9h18s-3-2-3-9" }),
66
+ /* @__PURE__ */ jsx("path", { d: "M13.7 21a2 2 0 0 1-3.4 0" })
67
+ ] }),
68
+ grid: /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsx("circle", { cx: "6", cy: "6", r: "1.6", fill: "currentColor", stroke: "none" }),
70
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "6", r: "1.6", fill: "currentColor", stroke: "none" }),
71
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "6", r: "1.6", fill: "currentColor", stroke: "none" }),
72
+ /* @__PURE__ */ jsx("circle", { cx: "6", cy: "12", r: "1.6", fill: "currentColor", stroke: "none" }),
73
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.6", fill: "currentColor", stroke: "none" }),
74
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "12", r: "1.6", fill: "currentColor", stroke: "none" }),
75
+ /* @__PURE__ */ jsx("circle", { cx: "6", cy: "18", r: "1.6", fill: "currentColor", stroke: "none" }),
76
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "18", r: "1.6", fill: "currentColor", stroke: "none" }),
77
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "1.6", fill: "currentColor", stroke: "none" })
78
+ ] }),
79
+ more: /* @__PURE__ */ jsxs(Fragment, { children: [
80
+ /* @__PURE__ */ jsx("circle", { cx: "5", cy: "12", r: "1.6", fill: "currentColor", stroke: "none" }),
81
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.6", fill: "currentColor", stroke: "none" }),
82
+ /* @__PURE__ */ jsx("circle", { cx: "19", cy: "12", r: "1.6", fill: "currentColor", stroke: "none" })
83
+ ] }),
84
+ maximize: /* @__PURE__ */ jsx("path", { d: "M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3" }),
85
+ check: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }),
86
+ x: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }),
87
+ "chevron-right": /* @__PURE__ */ jsx("path", { d: "m9 6 6 6-6 6" }),
88
+ "chevron-down": /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }),
89
+ "chevron-up": /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }),
90
+ phone: /* @__PURE__ */ jsx("path", { d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z" }),
91
+ clock: /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
93
+ /* @__PURE__ */ jsx("path", { d: "M12 7v5l3 2" })
94
+ ] }),
95
+ link: /* @__PURE__ */ jsxs(Fragment, { children: [
96
+ /* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
97
+ /* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
98
+ ] }),
99
+ "arrow-down-right": /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ /* @__PURE__ */ jsx("path", { d: "M7 7l10 10" }),
101
+ /* @__PURE__ */ jsx("path", { d: "M17 7v10H7" })
102
+ ] }),
103
+ "arrow-up-right": /* @__PURE__ */ jsxs(Fragment, { children: [
104
+ /* @__PURE__ */ jsx("path", { d: "M7 17 17 7" }),
105
+ /* @__PURE__ */ jsx("path", { d: "M7 7h10v10" })
106
+ ] }),
107
+ droplet: /* @__PURE__ */ jsx("path", { d: "M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5S12.5 5 12 2.5C11.5 5 10 7 8 8.5S5 13 5 15a7 7 0 0 0 7 7Z" }),
108
+ "file-text": /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ /* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
110
+ /* @__PURE__ */ jsx("path", { d: "M14 2v6h6M16 13H8M16 17H8M10 9H8" })
111
+ ] })
112
+ };
113
+ function Icon({ name, size = 20, title, ...rest }) {
114
+ return /* @__PURE__ */ jsxs(
115
+ "svg",
116
+ {
117
+ width: size,
118
+ height: size,
119
+ viewBox: "0 0 24 24",
120
+ fill: "none",
121
+ stroke: "currentColor",
122
+ strokeWidth: 2,
123
+ strokeLinecap: "round",
124
+ strokeLinejoin: "round",
125
+ role: title ? "img" : void 0,
126
+ "aria-label": title,
127
+ "aria-hidden": title ? void 0 : true,
128
+ ...rest,
129
+ children: [
130
+ title && /* @__PURE__ */ jsx("title", { children: title }),
131
+ PATHS[name]
132
+ ]
133
+ }
134
+ );
135
+ }
136
+ function Button({ variant = "filled", className, ...props }) {
137
+ return /* @__PURE__ */ jsx(Button$1, { ...props, "data-variant": variant, className: cx("prn-button", className) });
138
+ }
139
+ function TextField({ label, description, errorMessage, placeholder, className, ...props }) {
140
+ return /* @__PURE__ */ jsxs(TextField$1, { ...props, className: cx("prn-field", className), children: [
141
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
142
+ /* @__PURE__ */ jsx(Input, { className: "prn-input", placeholder }),
143
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
144
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
145
+ ] });
146
+ }
147
+ function SearchField({ label, placeholder, className, ...props }) {
148
+ return /* @__PURE__ */ jsxs(SearchField$1, { ...props, className: cx("prn-field prn-searchfield", className), children: [
149
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
150
+ /* @__PURE__ */ jsx(Input, { className: "prn-input", placeholder })
151
+ ] });
152
+ }
153
+ function Checkbox({ children, className, ...props }) {
154
+ return /* @__PURE__ */ jsxs(Checkbox$1, { ...props, className: cx("prn-checkbox", className), children: [
155
+ /* @__PURE__ */ jsx("span", { className: "prn-checkbox-box", "aria-hidden": true, children: /* @__PURE__ */ jsx(
156
+ "svg",
157
+ {
158
+ viewBox: "0 0 18 18",
159
+ className: "prn-checkbox-check",
160
+ width: "14",
161
+ height: "14",
162
+ fill: "none",
163
+ stroke: "currentColor",
164
+ children: /* @__PURE__ */ jsx("polyline", { points: "4,9 8,13 14,5" })
165
+ }
166
+ ) }),
167
+ children && /* @__PURE__ */ jsx("span", { className: "prn-checkbox-label", children })
168
+ ] });
169
+ }
170
+ function Switch({ children, className, ...props }) {
171
+ return /* @__PURE__ */ jsxs(Switch$1, { ...props, className: cx("prn-switch", className), children: [
172
+ children && /* @__PURE__ */ jsx("span", { className: "prn-switch-label", children }),
173
+ /* @__PURE__ */ jsx("span", { className: "prn-switch-track", "aria-hidden": true, children: /* @__PURE__ */ jsx("span", { className: "prn-switch-handle" }) })
174
+ ] });
175
+ }
176
+ function Select({ label, placeholder, children, className, ...props }) {
177
+ return /* @__PURE__ */ jsxs(Select$1, { ...props, className: cx("prn-field prn-select", className), children: [
178
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
179
+ /* @__PURE__ */ jsxs(Button$1, { className: "prn-select-button", children: [
180
+ /* @__PURE__ */ jsx(SelectValue, { className: "prn-select-value", children: placeholder }),
181
+ /* @__PURE__ */ jsx(
182
+ "svg",
183
+ {
184
+ className: "prn-select-chevron",
185
+ viewBox: "0 0 12 12",
186
+ width: "12",
187
+ height: "12",
188
+ "aria-hidden": true,
189
+ fill: "none",
190
+ stroke: "currentColor",
191
+ strokeWidth: "1.6",
192
+ strokeLinecap: "round",
193
+ strokeLinejoin: "round",
194
+ children: /* @__PURE__ */ jsx("path", { d: "M2.75 4.5 6 7.75 9.25 4.5" })
195
+ }
196
+ )
197
+ ] }),
198
+ /* @__PURE__ */ jsx(Popover, { className: "prn-popover prn-select-popover", children: /* @__PURE__ */ jsx(ListBox, { className: "prn-listbox", children }) })
199
+ ] });
200
+ }
201
+ function SelectItem({ className, ...props }) {
202
+ return /* @__PURE__ */ jsx(ListBoxItem, { ...props, className: cx("prn-option", className) });
203
+ }
204
+ function Modal({ title, children, className, isDismissable = true, glass, ...props }) {
205
+ return /* @__PURE__ */ jsx(ModalOverlay, { ...props, isDismissable, className: "prn-modal-overlay", children: /* @__PURE__ */ jsx(Modal$1, { className: cx("prn-modal", glass && "prn-glass prn-glass-overlay"), children: /* @__PURE__ */ jsxs(Dialog, { className: cx("prn-dialog", className), children: [
206
+ title && /* @__PURE__ */ jsx(Heading, { slot: "title", className: "prn-dialog-title", children: title }),
207
+ children
208
+ ] }) }) });
209
+ }
210
+ function Menu({ trigger, children, glass, className }) {
211
+ return /* @__PURE__ */ jsxs(MenuTrigger, { children: [
212
+ trigger,
213
+ /* @__PURE__ */ jsx(Popover, { className: cx("prn-popover", glass && "prn-glass prn-glass-overlay"), children: /* @__PURE__ */ jsx(Menu$1, { className: cx("prn-menu", className), children }) })
214
+ ] });
215
+ }
216
+ function MenuItem({ className, ...props }) {
217
+ return /* @__PURE__ */ jsx(MenuItem$1, { ...props, className: cx("prn-menu-item", className) });
218
+ }
219
+ function Popover2({ glass, className, children, ...props }) {
220
+ return /* @__PURE__ */ jsx(
221
+ Popover,
222
+ {
223
+ ...props,
224
+ className: cx("prn-popover", glass && "prn-glass prn-glass-overlay", className),
225
+ children
226
+ }
227
+ );
228
+ }
229
+ function Tooltip({ trigger, children, delay = 600, className }) {
230
+ return /* @__PURE__ */ jsxs(TooltipTrigger, { delay, children: [
231
+ trigger,
232
+ /* @__PURE__ */ jsxs(Tooltip$1, { className: cx("prn-tooltip", className), children: [
233
+ /* @__PURE__ */ jsx(OverlayArrow, { className: "prn-tooltip-arrow", children: /* @__PURE__ */ jsx("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx("path", { d: "M0 0 L4 4 L8 0" }) }) }),
234
+ children
235
+ ] })
236
+ ] });
237
+ }
238
+ function SegmentedControl({ className, disallowEmptySelection = true, ...props }) {
239
+ return /* @__PURE__ */ jsx(
240
+ ToggleButtonGroup,
241
+ {
242
+ ...props,
243
+ selectionMode: "single",
244
+ disallowEmptySelection,
245
+ className: cx("prn-segmented", className)
246
+ }
247
+ );
248
+ }
249
+ function Segment({ className, ...props }) {
250
+ return /* @__PURE__ */ jsx(ToggleButton, { ...props, className: cx("prn-segment", className) });
251
+ }
252
+ function Tabs({ className, ...props }) {
253
+ return /* @__PURE__ */ jsx(Tabs$1, { ...props, className: cx("prn-tabs", className) });
254
+ }
255
+ function TabBar({ className, ...props }) {
256
+ return /* @__PURE__ */ jsx(TabList, { ...props, className: cx("prn-tablist", className) });
257
+ }
258
+ function Tab({ className, ...props }) {
259
+ return /* @__PURE__ */ jsx(Tab$1, { ...props, className: cx("prn-tab", className) });
260
+ }
261
+ function TabPanel({ className, ...props }) {
262
+ return /* @__PURE__ */ jsx(TabPanel$1, { ...props, className: cx("prn-tabpanel", className) });
263
+ }
264
+ function Card({
265
+ title,
266
+ header,
267
+ padding = "regular",
268
+ translucent = false,
269
+ onPress,
270
+ style,
271
+ children,
272
+ className
273
+ }) {
274
+ const hasHeader = title != null || header != null;
275
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
276
+ hasHeader && /* @__PURE__ */ jsxs("header", { className: "prn-card-head", children: [
277
+ title != null && /* @__PURE__ */ jsx("h3", { className: "prn-card-title", children: title }),
278
+ header != null && /* @__PURE__ */ jsx("div", { className: "prn-card-head-slot", children: header })
279
+ ] }),
280
+ children
281
+ ] });
282
+ if (onPress) {
283
+ return /* @__PURE__ */ jsx(
284
+ Button$1,
285
+ {
286
+ className: cx("prn-card", "prn-card-pressable", className),
287
+ style,
288
+ "data-padding": padding,
289
+ "data-translucent": translucent ? "" : void 0,
290
+ onPress,
291
+ children: inner
292
+ }
293
+ );
294
+ }
295
+ return /* @__PURE__ */ jsx(
296
+ "section",
297
+ {
298
+ className: cx("prn-card", className),
299
+ style,
300
+ "data-padding": padding,
301
+ "data-translucent": translucent ? "" : void 0,
302
+ children: inner
303
+ }
304
+ );
305
+ }
306
+ var TREND_GLYPH = { up: "\u2191", down: "\u2193", flat: "\u2192" };
307
+ function KpiCard({
308
+ label,
309
+ value,
310
+ delta,
311
+ trend,
312
+ tone,
313
+ onPress,
314
+ accent = false,
315
+ icon,
316
+ className
317
+ }) {
318
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
319
+ /* @__PURE__ */ jsxs("div", { className: "prn-kpi-top", children: [
320
+ icon != null && /* @__PURE__ */ jsx("span", { className: "prn-kpi-icon", "aria-hidden": true, children: icon }),
321
+ /* @__PURE__ */ jsx("span", { className: "prn-kpi-label", children: label })
322
+ ] }),
323
+ /* @__PURE__ */ jsx("div", { className: "prn-kpi-value prn-tnum", "data-tone": tone, children: value }),
324
+ delta != null && /* @__PURE__ */ jsxs("div", { className: "prn-kpi-delta", "data-trend": trend ?? "flat", children: [
325
+ trend != null && /* @__PURE__ */ jsx("span", { className: "prn-kpi-arrow", "aria-hidden": true, children: TREND_GLYPH[trend] ?? "" }),
326
+ /* @__PURE__ */ jsx("span", { children: delta })
327
+ ] })
328
+ ] });
329
+ if (onPress) {
330
+ return /* @__PURE__ */ jsx(
331
+ Button$1,
332
+ {
333
+ className: cx("prn-kpi prn-kpi-pressable", className),
334
+ "data-accent": accent ? "" : void 0,
335
+ onPress,
336
+ children: inner
337
+ }
338
+ );
339
+ }
340
+ return /* @__PURE__ */ jsx("section", { className: cx("prn-kpi", className), "data-accent": accent ? "" : void 0, children: inner });
341
+ }
342
+ function Badge({
343
+ tone = "neutral",
344
+ variant = "soft",
345
+ icon,
346
+ color,
347
+ textColor,
348
+ style,
349
+ children,
350
+ className
351
+ }) {
352
+ const mergedStyle = {
353
+ ...color != null ? { "--prn-badge-color": color } : {},
354
+ ...textColor != null ? { "--prn-badge-text-color": textColor } : {},
355
+ ...style
356
+ };
357
+ return /* @__PURE__ */ jsxs(
358
+ "span",
359
+ {
360
+ className: cx("prn-badge", className),
361
+ "data-tone": tone,
362
+ "data-variant": variant,
363
+ "data-custom-color": color != null ? "" : void 0,
364
+ style: mergedStyle,
365
+ children: [
366
+ icon != null && /* @__PURE__ */ jsx("span", { className: "prn-badge-icon", "aria-hidden": true, children: icon }),
367
+ children
368
+ ]
369
+ }
370
+ );
371
+ }
372
+ function splitDecimals(text) {
373
+ const match = text.match(/^(.*[\d\s])([.,]\d+)(\D*)$/);
374
+ if (!match) return { head: text, tail: null };
375
+ const [, head = "", dec = "", suffix = ""] = match;
376
+ return { head, tail: dec + suffix };
377
+ }
378
+ function Amount({
379
+ value,
380
+ currency,
381
+ locale = "de-DE",
382
+ minimumFractionDigits,
383
+ maximumFractionDigits,
384
+ colored = false,
385
+ signed = false,
386
+ dimDecimals = false,
387
+ className
388
+ }) {
389
+ const isString = typeof value === "string";
390
+ const formatted = isString ? value : new Intl.NumberFormat(locale, {
391
+ ...currency ? { style: "currency", currency } : {},
392
+ ...minimumFractionDigits != null ? { minimumFractionDigits } : {},
393
+ ...maximumFractionDigits != null ? { maximumFractionDigits } : {},
394
+ signDisplay: signed ? "exceptZero" : "auto"
395
+ }).format(value);
396
+ const sign = isString ? value.trimStart().startsWith("-") ? "neg" : "pos" : value > 0 ? "pos" : value < 0 ? "neg" : "zero";
397
+ const { head, tail } = dimDecimals ? splitDecimals(formatted) : { head: formatted, tail: null };
398
+ return /* @__PURE__ */ jsx(
399
+ "span",
400
+ {
401
+ className: cx("prn-amount prn-tnum", className),
402
+ "data-colored": colored ? "" : void 0,
403
+ "data-sign": sign,
404
+ children: tail != null ? /* @__PURE__ */ jsxs(Fragment, { children: [
405
+ head,
406
+ /* @__PURE__ */ jsx("span", { className: "prn-amount-dec", "aria-hidden": false, children: tail })
407
+ ] }) : formatted
408
+ }
409
+ );
410
+ }
411
+ function List({ children, label, inset = false, className }) {
412
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-list", className), "data-inset": inset ? "" : void 0, children: [
413
+ label != null && /* @__PURE__ */ jsx("div", { className: "prn-list-label", children: label }),
414
+ /* @__PURE__ */ jsx("div", { className: "prn-list-rows", role: "list", children })
415
+ ] });
416
+ }
417
+ function ListRow({
418
+ leading,
419
+ title,
420
+ subtitle,
421
+ trailing,
422
+ onPress,
423
+ isActive,
424
+ isDisabled,
425
+ className
426
+ }) {
427
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
428
+ leading != null && /* @__PURE__ */ jsx("span", { className: "prn-row-leading", children: leading }),
429
+ /* @__PURE__ */ jsxs("span", { className: "prn-row-main", children: [
430
+ title != null && /* @__PURE__ */ jsx("span", { className: "prn-row-title", children: title }),
431
+ subtitle != null && /* @__PURE__ */ jsx("span", { className: "prn-row-subtitle", children: subtitle })
432
+ ] }),
433
+ trailing != null && /* @__PURE__ */ jsx("span", { className: "prn-row-trailing", children: trailing })
434
+ ] });
435
+ if (onPress) {
436
+ return /* @__PURE__ */ jsx(
437
+ Button$1,
438
+ {
439
+ className: cx("prn-row prn-row-pressable", className),
440
+ onPress,
441
+ isDisabled,
442
+ "data-active": isActive ? "" : void 0,
443
+ children: inner
444
+ }
445
+ );
446
+ }
447
+ return /* @__PURE__ */ jsx(
448
+ "div",
449
+ {
450
+ className: cx("prn-row", className),
451
+ role: "listitem",
452
+ "data-active": isActive ? "" : void 0,
453
+ "aria-disabled": isDisabled || void 0,
454
+ children: inner
455
+ }
456
+ );
457
+ }
458
+ function SidebarGroupView({
459
+ group,
460
+ selectedKey,
461
+ onSelect
462
+ }) {
463
+ const collapsible = group.collapsible === true && group.label != null;
464
+ const [collapsed, setCollapsed] = useState(
465
+ collapsible ? group.defaultCollapsed === true : false
466
+ );
467
+ const items = /* @__PURE__ */ jsx("div", { className: "prn-sidebar-group-items", role: collapsible ? "group" : void 0, hidden: collapsed, children: group.items.map((item) => /* @__PURE__ */ jsxs(
468
+ Button$1,
469
+ {
470
+ className: "prn-sidebar-item",
471
+ "data-active": item.id === selectedKey ? "" : void 0,
472
+ onPress: () => onSelect?.(item.id),
473
+ children: [
474
+ item.icon != null && /* @__PURE__ */ jsx("span", { className: "prn-sidebar-item-icon", "aria-hidden": true, children: item.icon }),
475
+ /* @__PURE__ */ jsx("span", { className: "prn-sidebar-item-label", children: item.label }),
476
+ item.trailing != null && /* @__PURE__ */ jsx("span", { className: "prn-sidebar-item-trailing", children: item.trailing })
477
+ ]
478
+ },
479
+ item.id
480
+ )) });
481
+ return /* @__PURE__ */ jsxs("div", { className: "prn-sidebar-group", "data-collapsible": collapsible ? "" : void 0, children: [
482
+ group.label != null && (collapsible ? /* @__PURE__ */ jsxs(
483
+ Button$1,
484
+ {
485
+ className: "prn-sidebar-group-label prn-sidebar-group-toggle",
486
+ "aria-expanded": !collapsed,
487
+ "data-collapsed": collapsed ? "" : void 0,
488
+ onPress: () => setCollapsed((c) => !c),
489
+ children: [
490
+ /* @__PURE__ */ jsx("span", { className: "prn-sidebar-group-chevron", "aria-hidden": true, children: "\u203A" }),
491
+ /* @__PURE__ */ jsx("span", { className: "prn-sidebar-group-label-text", children: group.label })
492
+ ]
493
+ }
494
+ ) : /* @__PURE__ */ jsx("div", { className: "prn-sidebar-group-label", children: group.label })),
495
+ items
496
+ ] });
497
+ }
498
+ function Sidebar({
499
+ groups,
500
+ selectedKey,
501
+ onSelect,
502
+ header,
503
+ footer,
504
+ glass,
505
+ className
506
+ }) {
507
+ return /* @__PURE__ */ jsxs(
508
+ "nav",
509
+ {
510
+ className: cx("prn-sidebar", glass && "prn-glass prn-glass-sidebar", className),
511
+ "aria-label": "Seitenleiste",
512
+ children: [
513
+ header != null && /* @__PURE__ */ jsx("div", { className: "prn-sidebar-header", children: header }),
514
+ /* @__PURE__ */ jsx("div", { className: "prn-sidebar-scroll", children: groups.map((group, gi) => /* @__PURE__ */ jsx(
515
+ SidebarGroupView,
516
+ {
517
+ group,
518
+ selectedKey,
519
+ onSelect
520
+ },
521
+ gi
522
+ )) }),
523
+ footer != null && /* @__PURE__ */ jsx("div", { className: "prn-sidebar-footer", children: footer })
524
+ ]
525
+ }
526
+ );
527
+ }
528
+ function Toolbar({ title, subtitle, leading, actions, glass, className }) {
529
+ return /* @__PURE__ */ jsxs("header", { className: cx("prn-toolbar", glass && "prn-glass prn-glass-bar", className), children: [
530
+ leading != null && /* @__PURE__ */ jsx("div", { className: "prn-toolbar-leading", children: leading }),
531
+ /* @__PURE__ */ jsxs("div", { className: "prn-toolbar-titles", children: [
532
+ title != null && /* @__PURE__ */ jsx("span", { className: "prn-toolbar-title", children: title }),
533
+ subtitle != null && /* @__PURE__ */ jsx("span", { className: "prn-toolbar-subtitle", children: subtitle })
534
+ ] }),
535
+ actions != null && /* @__PURE__ */ jsx("div", { className: "prn-toolbar-actions", children: actions })
536
+ ] });
537
+ }
538
+ function EmptyState({ icon, title, description, action, className }) {
539
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-empty", className), children: [
540
+ icon != null && /* @__PURE__ */ jsx("div", { className: "prn-empty-icon", "aria-hidden": true, children: icon }),
541
+ /* @__PURE__ */ jsx("div", { className: "prn-empty-title", children: title }),
542
+ description != null && /* @__PURE__ */ jsx("div", { className: "prn-empty-desc", children: description }),
543
+ action != null && /* @__PURE__ */ jsx("div", { className: "prn-empty-action", children: action })
544
+ ] });
545
+ }
546
+ var NOTICE_GLYPH = {
547
+ info: "\u2139",
548
+ positive: "\u2713",
549
+ critical: "!",
550
+ negative: "\u2715"
551
+ };
552
+ function Notice({ tone = "info", title, icon, children, className }) {
553
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-notice", className), "data-tone": tone, role: "status", children: [
554
+ /* @__PURE__ */ jsx("span", { className: "prn-notice-icon", "aria-hidden": true, children: icon ?? NOTICE_GLYPH[tone] ?? "" }),
555
+ /* @__PURE__ */ jsxs("div", { className: "prn-notice-body", children: [
556
+ title != null && /* @__PURE__ */ jsx("div", { className: "prn-notice-title", children: title }),
557
+ children != null && /* @__PURE__ */ jsx("div", { className: "prn-notice-text", children })
558
+ ] })
559
+ ] });
560
+ }
561
+ function DescriptionList({
562
+ children,
563
+ layout = "stacked",
564
+ className
565
+ }) {
566
+ return /* @__PURE__ */ jsx("dl", { className: cx("prn-dl", className), "data-layout": layout, children });
567
+ }
568
+ function Field({ label, value, children, className }) {
569
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-field", className), children: [
570
+ /* @__PURE__ */ jsx("dt", { className: "prn-field-label", children: label }),
571
+ /* @__PURE__ */ jsx("dd", { className: "prn-field-value", children: value ?? children })
572
+ ] });
573
+ }
574
+ function BarButton({
575
+ label,
576
+ count,
577
+ onClick,
578
+ className,
579
+ children
580
+ }) {
581
+ return /* @__PURE__ */ jsxs(
582
+ "button",
583
+ {
584
+ type: "button",
585
+ className: cx("prn-shellbar-btn", className),
586
+ "aria-label": label,
587
+ title: label,
588
+ onClick,
589
+ children: [
590
+ children,
591
+ count != null && count !== "" && /* @__PURE__ */ jsx("span", { className: "prn-shellbar-badge", children: count })
592
+ ]
593
+ }
594
+ );
595
+ }
596
+ function AppShell({
597
+ title,
598
+ subtitle,
599
+ logo,
600
+ onLogoClick,
601
+ menuItems,
602
+ onMenuItemClick,
603
+ search,
604
+ actions,
605
+ items,
606
+ notifications,
607
+ notificationsCount,
608
+ onNotificationsClick,
609
+ productSwitch,
610
+ onProductSwitchClick,
611
+ user,
612
+ onProfileClick,
613
+ startButton,
614
+ sidebar,
615
+ sidebarCollapsed,
616
+ defaultSidebarCollapsed = false,
617
+ onSidebarCollapsedChange,
618
+ glass = true,
619
+ toggleLabel = "Navigation umschalten",
620
+ children,
621
+ className
622
+ }) {
623
+ const isControlled = sidebarCollapsed !== void 0;
624
+ const [internal, setInternal] = useState(() => {
625
+ if (defaultSidebarCollapsed) return true;
626
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(max-width: 767px)").matches) {
627
+ return true;
628
+ }
629
+ return false;
630
+ });
631
+ const collapsed = isControlled ? sidebarCollapsed : internal;
632
+ const [searchOpen, setSearchOpen] = useState(false);
633
+ const sidebarId = useId();
634
+ const setCollapsed = useCallback(
635
+ (next) => {
636
+ if (!isControlled) setInternal(next);
637
+ onSidebarCollapsedChange?.(next);
638
+ },
639
+ [isControlled, onSidebarCollapsedChange]
640
+ );
641
+ const hasItems = items != null && items.length > 0;
642
+ const titleNode = menuItems != null && menuItems.length > 0 ? /* @__PURE__ */ jsx(
643
+ Menu,
644
+ {
645
+ trigger: /* @__PURE__ */ jsxs(Button, { variant: "plain", className: "prn-shellbar-titlebtn", children: [
646
+ /* @__PURE__ */ jsx("span", { className: "prn-shellbar-title", children: title }),
647
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: 16 })
648
+ ] }),
649
+ children: menuItems.map((mi) => /* @__PURE__ */ jsxs(MenuItem, { onAction: () => onMenuItemClick?.(mi.id), children: [
650
+ mi.icon,
651
+ mi.label
652
+ ] }, mi.id))
653
+ }
654
+ ) : title != null && /* @__PURE__ */ jsx("span", { className: "prn-shellbar-title", children: title });
655
+ return /* @__PURE__ */ jsxs(
656
+ "div",
657
+ {
658
+ className: cx("prn-appshell", className),
659
+ "data-collapsed": collapsed ? "" : void 0,
660
+ "data-search-open": searchOpen ? "" : void 0,
661
+ children: [
662
+ /* @__PURE__ */ jsxs("header", { className: cx("prn-shellbar", glass && "prn-glass prn-glass-bar"), children: [
663
+ startButton,
664
+ sidebar != null && /* @__PURE__ */ jsx(
665
+ "button",
666
+ {
667
+ type: "button",
668
+ className: "prn-shellbar-toggle",
669
+ "aria-label": toggleLabel,
670
+ "aria-expanded": !collapsed,
671
+ "aria-controls": sidebarId,
672
+ onClick: () => setCollapsed(!collapsed),
673
+ children: /* @__PURE__ */ jsx(Icon, { name: "menu", size: 20 })
674
+ }
675
+ ),
676
+ logo != null && (onLogoClick ? /* @__PURE__ */ jsx("button", { type: "button", className: "prn-shellbar-logo prn-shellbar-logobtn", "aria-label": "Startseite", onClick: onLogoClick, children: logo }) : /* @__PURE__ */ jsx("div", { className: "prn-shellbar-logo", children: logo })),
677
+ /* @__PURE__ */ jsxs("div", { className: "prn-shellbar-titles", children: [
678
+ titleNode,
679
+ subtitle != null && /* @__PURE__ */ jsx("span", { className: "prn-shellbar-subtitle", children: subtitle })
680
+ ] }),
681
+ search != null && /* @__PURE__ */ jsx("div", { className: "prn-shellbar-search", children: search }),
682
+ /* @__PURE__ */ jsx("div", { className: "prn-shellbar-spacer" }),
683
+ hasItems && /* @__PURE__ */ jsxs(Fragment, { children: [
684
+ /* @__PURE__ */ jsx("div", { className: "prn-shellbar-items", children: items.map((it) => /* @__PURE__ */ jsx(BarButton, { label: it.label, count: it.count, onClick: it.onClick, children: it.icon }, it.id)) }),
685
+ /* @__PURE__ */ jsx("div", { className: "prn-shellbar-overflow", children: /* @__PURE__ */ jsx(
686
+ Menu,
687
+ {
688
+ trigger: /* @__PURE__ */ jsx(Button, { variant: "plain", className: "prn-shellbar-btn", "aria-label": "Weitere Aktionen", children: /* @__PURE__ */ jsx(Icon, { name: "more", size: 20 }) }),
689
+ children: items.map((it) => /* @__PURE__ */ jsxs(MenuItem, { onAction: it.onClick, children: [
690
+ it.icon,
691
+ it.label,
692
+ it.count != null && it.count !== "" ? ` (${it.count})` : ""
693
+ ] }, it.id))
694
+ }
695
+ ) })
696
+ ] }),
697
+ search != null && /* @__PURE__ */ jsx(
698
+ "button",
699
+ {
700
+ type: "button",
701
+ className: "prn-shellbar-searchtoggle",
702
+ "aria-label": "Suche umschalten",
703
+ "aria-expanded": searchOpen,
704
+ onClick: () => setSearchOpen((o) => !o),
705
+ children: /* @__PURE__ */ jsx(Icon, { name: searchOpen ? "x" : "search", size: 20 })
706
+ }
707
+ ),
708
+ notifications && /* @__PURE__ */ jsx(BarButton, { label: "Benachrichtigungen", count: notificationsCount, onClick: onNotificationsClick, children: /* @__PURE__ */ jsx(Icon, { name: "bell", size: 20 }) }),
709
+ productSwitch && /* @__PURE__ */ jsx(BarButton, { label: "Produkte", className: "prn-shellbar-productswitch", onClick: onProductSwitchClick, children: /* @__PURE__ */ jsx(Icon, { name: "grid", size: 20 }) }),
710
+ user != null && (onProfileClick ? /* @__PURE__ */ jsx("button", { type: "button", className: "prn-shellbar-user prn-shellbar-userbtn", "aria-label": "Konto", onClick: onProfileClick, children: user }) : /* @__PURE__ */ jsx("div", { className: "prn-shellbar-user", children: user })),
711
+ actions != null && /* @__PURE__ */ jsx("div", { className: "prn-shellbar-actions", children: actions })
712
+ ] }),
713
+ search != null && searchOpen && /* @__PURE__ */ jsx("div", { className: "prn-shellbar-searchrow", children: search }),
714
+ /* @__PURE__ */ jsxs("div", { className: "prn-appshell-body", children: [
715
+ sidebar != null && /* @__PURE__ */ jsxs(Fragment, { children: [
716
+ /* @__PURE__ */ jsx(
717
+ "div",
718
+ {
719
+ id: sidebarId,
720
+ className: cx("prn-appshell-sidebar", glass && "prn-glass prn-glass-sidebar"),
721
+ children: sidebar
722
+ }
723
+ ),
724
+ /* @__PURE__ */ jsx("div", { className: "prn-appshell-scrim", onClick: () => setCollapsed(true), "aria-hidden": true })
725
+ ] }),
726
+ /* @__PURE__ */ jsx("main", { className: "prn-appshell-content", children })
727
+ ] })
728
+ ]
729
+ }
730
+ );
731
+ }
732
+ function seriesColor(index) {
733
+ const n = (index % 8 + 8) % 8 + 1;
734
+ return `var(--prn-chart-${n})`;
735
+ }
736
+ function smoothPath(points, tension = 0.5) {
737
+ if (points.length < 2) return "";
738
+ const first = points[0];
739
+ if (!first) return "";
740
+ if (points.length === 2) {
741
+ const second = points[1];
742
+ if (!second) return "";
743
+ return `M ${first.x},${first.y} L ${second.x},${second.y}`;
744
+ }
745
+ let d = `M ${first.x},${first.y}`;
746
+ for (let i = 0; i < points.length - 1; i++) {
747
+ const p0 = points[i - 1] ?? points[i];
748
+ const p1 = points[i];
749
+ const p2 = points[i + 1];
750
+ const p3 = points[i + 2] ?? points[i + 1];
751
+ if (!p0 || !p1 || !p2 || !p3) continue;
752
+ const cp1x = p1.x + (p2.x - p0.x) / 6 * tension * 2;
753
+ const cp1y = p1.y + (p2.y - p0.y) / 6 * tension * 2;
754
+ const cp2x = p2.x - (p3.x - p1.x) / 6 * tension * 2;
755
+ const cp2y = p2.y - (p3.y - p1.y) / 6 * tension * 2;
756
+ d += ` C ${cp1x},${cp1y} ${cp2x},${cp2y} ${p2.x},${p2.y}`;
757
+ }
758
+ return d;
759
+ }
760
+ function scaleY(values, height, pad) {
761
+ const min = Math.min(...values);
762
+ const max = Math.max(...values);
763
+ const span = max - min || 1;
764
+ const usable = height - pad * 2;
765
+ return (v) => pad + usable - (v - min) / span * usable;
766
+ }
767
+ function Sparkline({ data, width = 120, height = 36, color, className }) {
768
+ if (data.length === 0) {
769
+ return /* @__PURE__ */ jsx(ChartEmpty, { className: cx("prn-chart-sparkline", className), compact: true });
770
+ }
771
+ const pad = 3;
772
+ const stroke = color ?? seriesColor(0);
773
+ const yOf = scaleY(data, height, pad);
774
+ const stepX = data.length > 1 ? (width - pad * 2) / (data.length - 1) : 0;
775
+ const points = data.map((v, i) => ({ x: pad + i * stepX, y: yOf(v) }));
776
+ const line = data.length === 1 ? "" : smoothPath(points);
777
+ const last = points[points.length - 1];
778
+ return /* @__PURE__ */ jsxs(
779
+ "svg",
780
+ {
781
+ viewBox: `0 0 ${width} ${height}`,
782
+ preserveAspectRatio: "none",
783
+ className: cx("prn-chart", "prn-chart-sparkline", className),
784
+ role: "img",
785
+ "aria-hidden": true,
786
+ children: [
787
+ line && /* @__PURE__ */ jsx("path", { d: line, fill: "none", stroke, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }),
788
+ last && /* @__PURE__ */ jsx("circle", { cx: last.x, cy: last.y, r: 2.5, fill: stroke, vectorEffect: "non-scaling-stroke" })
789
+ ]
790
+ }
791
+ );
792
+ }
793
+ function AreaChart({ data, width = 320, height = 160, color, showAxes = false, className }) {
794
+ const gid = useId().replace(/[:]/g, "");
795
+ if (data.length === 0) {
796
+ return /* @__PURE__ */ jsx(ChartEmpty, { className });
797
+ }
798
+ const values = typeof data[0] === "number" ? data : data.map((p) => p.y);
799
+ const pad = showAxes ? 8 : 4;
800
+ const padBottom = showAxes ? 20 : pad;
801
+ const padLeft = showAxes ? 28 : pad;
802
+ const yOf = scaleY(values, height - (padBottom - pad), pad);
803
+ const stroke = color ?? seriesColor(0);
804
+ let points;
805
+ if (typeof data[0] === "number") {
806
+ const stepX = values.length > 1 ? (width - padLeft - pad) / (values.length - 1) : 0;
807
+ points = values.map((v, i) => ({ x: padLeft + i * stepX, y: yOf(v) }));
808
+ } else {
809
+ const xs = data.map((p) => p.x);
810
+ const minX = Math.min(...xs);
811
+ const maxX = Math.max(...xs);
812
+ const spanX = maxX - minX || 1;
813
+ points = data.map((p) => ({
814
+ x: padLeft + (p.x - minX) / spanX * (width - padLeft - pad),
815
+ y: yOf(p.y)
816
+ }));
817
+ }
818
+ const line = points.length === 1 ? "" : smoothPath(points);
819
+ const baseY = height - padBottom;
820
+ const firstP = points[0];
821
+ const lastP = points[points.length - 1];
822
+ const area = line && firstP && lastP ? `${line} L ${lastP.x},${baseY} L ${firstP.x},${baseY} Z` : "";
823
+ const gridLines = showAxes ? [0, 0.25, 0.5, 0.75, 1] : [];
824
+ const min = Math.min(...values);
825
+ const max = Math.max(...values);
826
+ return /* @__PURE__ */ jsxs(
827
+ "svg",
828
+ {
829
+ viewBox: `0 0 ${width} ${height}`,
830
+ className: cx("prn-chart", "prn-chart-area", className),
831
+ role: "img",
832
+ "aria-hidden": true,
833
+ children: [
834
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: `prn-area-${gid}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
835
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: stroke, stopOpacity: 0.32 }),
836
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: stroke, stopOpacity: 0 })
837
+ ] }) }),
838
+ showAxes && gridLines.map((g) => {
839
+ const y = pad + (baseY - pad) * g;
840
+ return /* @__PURE__ */ jsx(
841
+ "line",
842
+ {
843
+ x1: padLeft,
844
+ y1: y,
845
+ x2: width - pad,
846
+ y2: y,
847
+ className: "prn-chart-grid"
848
+ },
849
+ `grid-${g}`
850
+ );
851
+ }),
852
+ showAxes && /* @__PURE__ */ jsxs(Fragment, { children: [
853
+ /* @__PURE__ */ jsx("text", { x: padLeft - 5, y: pad + 4, className: "prn-chart-axislabel", textAnchor: "end", children: fmtCompact(max) }),
854
+ /* @__PURE__ */ jsx("text", { x: padLeft - 5, y: baseY, className: "prn-chart-axislabel", textAnchor: "end", children: fmtCompact(min) }),
855
+ /* @__PURE__ */ jsx("line", { x1: padLeft, y1: baseY, x2: width - pad, y2: baseY, className: "prn-chart-axis" })
856
+ ] }),
857
+ area && /* @__PURE__ */ jsx("path", { d: area, fill: `url(#prn-area-${gid})` }),
858
+ line && /* @__PURE__ */ jsx(
859
+ "path",
860
+ {
861
+ d: line,
862
+ fill: "none",
863
+ stroke,
864
+ strokeWidth: 2,
865
+ strokeLinecap: "round",
866
+ strokeLinejoin: "round"
867
+ }
868
+ ),
869
+ points.length === 1 && firstP && /* @__PURE__ */ jsx("circle", { cx: firstP.x, cy: firstP.y, r: 3, fill: stroke })
870
+ ]
871
+ }
872
+ );
873
+ }
874
+ function BarChart({ data, width = 320, height = 160, color, showLabels = true, className }) {
875
+ if (data.length === 0) {
876
+ return /* @__PURE__ */ jsx(ChartEmpty, { className });
877
+ }
878
+ const pad = 6;
879
+ const padBottom = showLabels ? 22 : pad;
880
+ const fill = color ?? seriesColor(0);
881
+ const values = data.map((d) => d.value);
882
+ const max = Math.max(...values, 0) || 1;
883
+ const usableH = height - pad - padBottom;
884
+ const slot = (width - pad * 2) / data.length;
885
+ const barW = Math.max(2, Math.min(slot * 0.62, 40));
886
+ const radius = Math.min(barW / 2, 5);
887
+ const baseY = height - padBottom;
888
+ return /* @__PURE__ */ jsx(
889
+ "svg",
890
+ {
891
+ viewBox: `0 0 ${width} ${height}`,
892
+ className: cx("prn-chart", "prn-chart-bar", className),
893
+ role: "img",
894
+ "aria-hidden": true,
895
+ children: data.map((d, i) => {
896
+ const h = max > 0 ? d.value / max * usableH : 0;
897
+ const x = pad + i * slot + (slot - barW) / 2;
898
+ const y = baseY - h;
899
+ return /* @__PURE__ */ jsxs("g", { children: [
900
+ /* @__PURE__ */ jsx("rect", { x, y, width: barW, height: Math.max(h, 0), rx: radius, ry: radius, fill }),
901
+ showLabels && /* @__PURE__ */ jsx("text", { x: x + barW / 2, y: height - 6, className: "prn-chart-axislabel", textAnchor: "middle", children: d.label })
902
+ ] }, `${d.label}-${i}`);
903
+ })
904
+ }
905
+ );
906
+ }
907
+ function DonutChart({
908
+ segments,
909
+ centerLabel,
910
+ size = 160,
911
+ thickness = 0.32,
912
+ showLegend = true,
913
+ className
914
+ }) {
915
+ const total = segments.reduce((sum, s) => sum + Math.max(0, s.value), 0);
916
+ if (segments.length === 0 || total <= 0) {
917
+ return /* @__PURE__ */ jsx(ChartEmpty, { className });
918
+ }
919
+ const cx0 = size / 2;
920
+ const cy0 = size / 2;
921
+ const r = size / 2 - 4;
922
+ const innerR = r * (1 - thickness);
923
+ let angle = -Math.PI / 2;
924
+ const arcs = segments.map((s, i) => {
925
+ const frac = Math.max(0, s.value) / total;
926
+ const start = angle;
927
+ const end = angle + frac * Math.PI * 2;
928
+ angle = end;
929
+ return {
930
+ d: donutArc(cx0, cy0, r, innerR, start, end),
931
+ color: s.color ?? seriesColor(i),
932
+ key: `${s.label}-${i}`
933
+ };
934
+ });
935
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-chart-donut", className), children: [
936
+ /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${size} ${size}`, className: "prn-chart", role: "img", "aria-hidden": true, children: [
937
+ arcs.map((a) => /* @__PURE__ */ jsx("path", { d: a.d, fill: a.color }, a.key)),
938
+ centerLabel != null && /* @__PURE__ */ jsx("foreignObject", { x: innerR * 0.4, y: cy0 - innerR * 0.7, width: size - innerR * 0.8, height: innerR * 1.4, children: /* @__PURE__ */ jsx("div", { className: "prn-chart-donut-center", children: centerLabel }) })
939
+ ] }),
940
+ showLegend && /* @__PURE__ */ jsx("ul", { className: "prn-chart-legend", children: segments.map((s, i) => /* @__PURE__ */ jsxs("li", { className: "prn-chart-legend-item", children: [
941
+ /* @__PURE__ */ jsx("span", { className: "prn-chart-legend-swatch", style: { background: s.color ?? seriesColor(i) }, "aria-hidden": true }),
942
+ /* @__PURE__ */ jsx("span", { className: "prn-chart-legend-label", children: s.label }),
943
+ /* @__PURE__ */ jsx("span", { className: "prn-chart-legend-value prn-tnum", children: fmtCompact(s.value) })
944
+ ] }, `${s.label}-${i}`)) })
945
+ ] });
946
+ }
947
+ function donutArc(cx0, cy0, rOuter, rInner, start, end) {
948
+ const sweep = end - start;
949
+ const e = sweep >= Math.PI * 2 ? end - 1e-4 : end;
950
+ const x0 = cx0 + rOuter * Math.cos(start);
951
+ const y0 = cy0 + rOuter * Math.sin(start);
952
+ const x1 = cx0 + rOuter * Math.cos(e);
953
+ const y1 = cy0 + rOuter * Math.sin(e);
954
+ const x2 = cx0 + rInner * Math.cos(e);
955
+ const y2 = cy0 + rInner * Math.sin(e);
956
+ const x3 = cx0 + rInner * Math.cos(start);
957
+ const y3 = cy0 + rInner * Math.sin(start);
958
+ const large = sweep > Math.PI ? 1 : 0;
959
+ return [
960
+ `M ${x0},${y0}`,
961
+ `A ${rOuter},${rOuter} 0 ${large} 1 ${x1},${y1}`,
962
+ `L ${x2},${y2}`,
963
+ `A ${rInner},${rInner} 0 ${large} 0 ${x3},${y3}`,
964
+ "Z"
965
+ ].join(" ");
966
+ }
967
+ function ChartEmpty({ message = "Keine Daten", compact = false, className }) {
968
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-chart-empty", compact && "prn-chart-empty--compact", className), role: "status", children: [
969
+ !compact && /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 48 48", className: "prn-chart-empty-icon", "aria-hidden": true, children: [
970
+ /* @__PURE__ */ jsx("rect", { x: "7", y: "26", width: "7", height: "15", rx: "2" }),
971
+ /* @__PURE__ */ jsx("rect", { x: "20", y: "18", width: "7", height: "23", rx: "2" }),
972
+ /* @__PURE__ */ jsx("rect", { x: "33", y: "10", width: "7", height: "31", rx: "2" })
973
+ ] }),
974
+ /* @__PURE__ */ jsx("span", { className: "prn-chart-empty-text", children: message })
975
+ ] });
976
+ }
977
+ function fmtCompact(n) {
978
+ const abs = Math.abs(n);
979
+ if (abs >= 1e6) return `${(n / 1e6).toFixed(1).replace(".", ",")}M`;
980
+ if (abs >= 1e3) return `${(n / 1e3).toFixed(1).replace(".", ",")}k`;
981
+ return `${n}`;
982
+ }
983
+ function asLabel(node, fallback) {
984
+ return typeof node === "string" ? node : fallback;
985
+ }
986
+ function cardLabel(card) {
987
+ const t = "title" in card ? card.title : void 0;
988
+ return asLabel(t, "Karte");
989
+ }
990
+ function trendLabel(t) {
991
+ return t === "up" ? "steigend" : t === "down" ? "fallend" : t === "flat" ? "unver\xE4ndert" : void 0;
992
+ }
993
+ function ExpandButton({ onPress }) {
994
+ return /* @__PURE__ */ jsx(Button$1, { className: "prn-lp-expand", "aria-label": "Vergr\xF6\xDFern", onPress, children: /* @__PURE__ */ jsx(Icon, { name: "maximize", size: 15 }) });
995
+ }
996
+ function CardBody({
997
+ card,
998
+ onExpand
999
+ }) {
1000
+ switch (card.kind) {
1001
+ case "nav":
1002
+ return /* @__PURE__ */ jsxs(Card, { className: "prn-lp-card prn-lp-nav", onPress: card.onPress, children: [
1003
+ card.icon != null && /* @__PURE__ */ jsx("div", { className: "prn-lp-nav-icon", children: card.icon }),
1004
+ /* @__PURE__ */ jsx("div", { className: "prn-lp-nav-title", children: card.title }),
1005
+ card.description != null && /* @__PURE__ */ jsx("div", { className: "prn-lp-nav-desc", children: card.description }),
1006
+ card.badge != null && /* @__PURE__ */ jsx("div", { className: "prn-lp-nav-badge", children: card.badge })
1007
+ ] });
1008
+ case "kpi":
1009
+ return /* @__PURE__ */ jsx(
1010
+ KpiCard,
1011
+ {
1012
+ className: "prn-lp-card",
1013
+ label: card.title,
1014
+ value: card.value,
1015
+ delta: card.delta,
1016
+ trend: card.trend,
1017
+ tone: card.tone,
1018
+ icon: card.icon,
1019
+ accent: card.accent,
1020
+ onPress: card.onPress
1021
+ }
1022
+ );
1023
+ case "trend":
1024
+ return /* @__PURE__ */ jsxs(
1025
+ Card,
1026
+ {
1027
+ className: "prn-lp-card prn-lp-trend",
1028
+ title: card.title,
1029
+ header: /* @__PURE__ */ jsx(ExpandButton, { onPress: () => onExpand(card) }),
1030
+ children: [
1031
+ /* @__PURE__ */ jsxs("div", { className: "prn-lp-trend-head", children: [
1032
+ card.value != null && /* @__PURE__ */ jsx("span", { className: "prn-lp-trend-value", children: card.value }),
1033
+ card.delta != null && /* @__PURE__ */ jsxs("span", { className: cx("prn-lp-delta", card.trend && `is-${card.trend}`), children: [
1034
+ card.trend === "up" && /* @__PURE__ */ jsx(Icon, { name: "chevron-up", size: 13, title: trendLabel("up") }),
1035
+ card.trend === "down" && /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: 13, title: trendLabel("down") }),
1036
+ card.delta
1037
+ ] })
1038
+ ] }),
1039
+ /* @__PURE__ */ jsx("div", { className: "prn-lp-trend-chart", children: /* @__PURE__ */ jsx(Sparkline, { data: card.data, width: 260, height: 48 }) })
1040
+ ]
1041
+ }
1042
+ );
1043
+ case "list":
1044
+ return /* @__PURE__ */ jsxs(
1045
+ Card,
1046
+ {
1047
+ className: "prn-lp-card prn-lp-list",
1048
+ title: /* @__PURE__ */ jsxs("span", { className: "prn-lp-list-title", children: [
1049
+ card.icon,
1050
+ card.title,
1051
+ card.count != null && /* @__PURE__ */ jsx("span", { className: "prn-lp-list-count", children: card.count })
1052
+ ] }),
1053
+ header: card.detail != null ? /* @__PURE__ */ jsx(ExpandButton, { onPress: () => onExpand(card) }) : void 0,
1054
+ children: [
1055
+ /* @__PURE__ */ jsx(List, { children: card.rows.slice(0, card.maxRows ?? 4).map((r) => /* @__PURE__ */ jsx(
1056
+ ListRow,
1057
+ {
1058
+ leading: r.leading,
1059
+ title: r.title,
1060
+ subtitle: r.subtitle,
1061
+ trailing: r.trailing,
1062
+ onPress: r.onPress
1063
+ },
1064
+ r.id
1065
+ )) }),
1066
+ card.onShowAll && /* @__PURE__ */ jsxs(Button$1, { className: "prn-lp-showall", onPress: card.onShowAll, slot: null, children: [
1067
+ "Alle anzeigen ",
1068
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: 14 })
1069
+ ] })
1070
+ ]
1071
+ }
1072
+ );
1073
+ case "custom":
1074
+ return /* @__PURE__ */ jsx(
1075
+ Card,
1076
+ {
1077
+ className: "prn-lp-card prn-lp-custom",
1078
+ title: card.title,
1079
+ header: card.detail != null ? /* @__PURE__ */ jsx(ExpandButton, { onPress: () => onExpand(card) }) : void 0,
1080
+ children: card.render()
1081
+ }
1082
+ );
1083
+ default:
1084
+ return null;
1085
+ }
1086
+ }
1087
+ function reorder(current, known, movedKeys, targetKey, position) {
1088
+ const base = current.filter(known);
1089
+ const rest = base.filter((id) => !movedKeys.includes(id));
1090
+ const tgt = rest.indexOf(targetKey);
1091
+ const at = tgt < 0 ? rest.length : position === "before" ? tgt : tgt + 1;
1092
+ rest.splice(at, 0, ...movedKeys);
1093
+ return rest;
1094
+ }
1095
+ function useSectionItems(section) {
1096
+ const byId = useMemo(() => new Map(section.cards.map((c) => [c.id, c])), [section.cards]);
1097
+ const [order, setOrder] = useState(() => section.cards.map((c) => c.id));
1098
+ const items = useMemo(() => {
1099
+ const known = order.filter((id) => byId.has(id));
1100
+ const fresh = section.cards.map((c) => c.id).filter((id) => !known.includes(id));
1101
+ return [...known, ...fresh].map((id) => byId.get(id)).filter(Boolean);
1102
+ }, [order, byId, section.cards]);
1103
+ return { byId, order, setOrder, items };
1104
+ }
1105
+ function EditableSection({
1106
+ section,
1107
+ onReorder,
1108
+ onExpand
1109
+ }) {
1110
+ const { byId, order, setOrder, items } = useSectionItems(section);
1111
+ const { dragAndDropHooks } = useDragAndDrop({
1112
+ getItems: (keys) => [...keys].map((k) => ({ "text/plain": String(k) })),
1113
+ renderDropIndicator: (target) => /* @__PURE__ */ jsx(DropIndicator, { target, className: "prn-lp-drop" }),
1114
+ onReorder(e) {
1115
+ const moved = [...e.keys].map(String);
1116
+ const next = reorder(order, (id) => byId.has(id), moved, String(e.target.key), e.target.dropPosition);
1117
+ setOrder(next);
1118
+ onReorder?.(section.id, next);
1119
+ }
1120
+ });
1121
+ return /* @__PURE__ */ jsx(
1122
+ GridList$1,
1123
+ {
1124
+ "aria-label": asLabel(section.title, "Karten"),
1125
+ items,
1126
+ layout: "grid",
1127
+ selectionMode: "none",
1128
+ className: "prn-lp-grid",
1129
+ dragAndDropHooks,
1130
+ children: (card) => /* @__PURE__ */ jsx(
1131
+ GridListItem$1,
1132
+ {
1133
+ id: card.id,
1134
+ textValue: cardLabel(card),
1135
+ className: "prn-lp-cell",
1136
+ "data-span": card.span ?? 1,
1137
+ children: /* @__PURE__ */ jsx(CardBody, { card, onExpand })
1138
+ }
1139
+ )
1140
+ }
1141
+ );
1142
+ }
1143
+ function StaticSection({
1144
+ section,
1145
+ onExpand
1146
+ }) {
1147
+ return /* @__PURE__ */ jsx("ul", { className: "prn-lp-grid", role: "list", "aria-label": asLabel(section.title, "Karten"), children: section.cards.map((card) => /* @__PURE__ */ jsx("li", { className: "prn-lp-cell", "data-span": card.span ?? 1, children: /* @__PURE__ */ jsx(CardBody, { card, onExpand }) }, card.id)) });
1148
+ }
1149
+ function CardDetail({ card }) {
1150
+ if ("detail" in card && card.detail != null) return /* @__PURE__ */ jsx(Fragment, { children: card.detail });
1151
+ if (card.kind === "trend") {
1152
+ return /* @__PURE__ */ jsxs("div", { className: "prn-lp-detail", children: [
1153
+ /* @__PURE__ */ jsxs("div", { className: "prn-lp-trend-head", children: [
1154
+ card.value != null && /* @__PURE__ */ jsx("span", { className: "prn-lp-trend-value", children: card.value }),
1155
+ card.delta != null && /* @__PURE__ */ jsxs("span", { className: cx("prn-lp-delta", card.trend && `is-${card.trend}`), children: [
1156
+ card.trend === "up" && /* @__PURE__ */ jsx(Icon, { name: "chevron-up", size: 13, title: trendLabel("up") }),
1157
+ card.trend === "down" && /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: 13, title: trendLabel("down") }),
1158
+ card.delta
1159
+ ] })
1160
+ ] }),
1161
+ /* @__PURE__ */ jsx(AreaChart, { data: card.data, width: 520, height: 260, showAxes: true })
1162
+ ] });
1163
+ }
1164
+ return null;
1165
+ }
1166
+ function Launchpad({ sections, editable = false, onReorder, className }) {
1167
+ const [expanded, setExpanded] = useState(null);
1168
+ const onExpand = useCallback((c) => setExpanded(c), []);
1169
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-launchpad", className), "data-editable": editable ? "" : void 0, children: [
1170
+ sections.map((s) => /* @__PURE__ */ jsxs("section", { className: "prn-lp-section", children: [
1171
+ (s.title != null || s.subtitle != null) && /* @__PURE__ */ jsxs("header", { className: "prn-lp-section-head", children: [
1172
+ s.icon != null && /* @__PURE__ */ jsx("span", { className: "prn-lp-section-icon", children: s.icon }),
1173
+ s.title != null && /* @__PURE__ */ jsx("h2", { className: "prn-lp-section-title", children: s.title }),
1174
+ s.subtitle != null && /* @__PURE__ */ jsx("span", { className: "prn-lp-section-sub", children: s.subtitle })
1175
+ ] }),
1176
+ editable ? /* @__PURE__ */ jsx(EditableSection, { section: s, onReorder, onExpand }) : /* @__PURE__ */ jsx(StaticSection, { section: s, onExpand })
1177
+ ] }, s.id)),
1178
+ expanded != null && /* @__PURE__ */ jsx(
1179
+ Modal,
1180
+ {
1181
+ isOpen: true,
1182
+ onOpenChange: (o) => !o && setExpanded(null),
1183
+ title: cardLabel(expanded),
1184
+ className: "prn-lp-modal",
1185
+ children: /* @__PURE__ */ jsx(CardDetail, { card: expanded })
1186
+ }
1187
+ )
1188
+ ] });
1189
+ }
1190
+ var SELECT_COL_ID = "__select__";
1191
+ var HIGHLIGHT_TRACK = "3px";
1192
+ var NAV_TRACK = "36px";
1193
+ var warnedNonPxPin = false;
1194
+ function pinStyle(column) {
1195
+ const pinned = column.getIsPinned();
1196
+ if (!pinned) return { pinned: void 0, style: void 0 };
1197
+ const width = column.columnDef.meta?.width;
1198
+ const isPx = typeof width === "string" && /^\d+(\.\d+)?px$/.test(width.trim());
1199
+ if (!isPx) {
1200
+ if (!warnedNonPxPin && typeof console !== "undefined") {
1201
+ warnedNonPxPin = true;
1202
+ console.warn(
1203
+ `[AnalyticalTable] Gepinnte Spalte "${column.id}" ben\xF6tigt eine px-Breite (width: "120px"); Sticky wird \xFCbersprungen.`
1204
+ );
1205
+ }
1206
+ return { pinned, style: void 0 };
1207
+ }
1208
+ const style = { position: "sticky", zIndex: 2 };
1209
+ if (pinned === "left") style.left = column.getStart("left");
1210
+ else style.right = column.getAfter("right");
1211
+ return { pinned, style };
1212
+ }
1213
+ function mergeTableOptions(base, opts) {
1214
+ const merged = { ...base, ...opts };
1215
+ merged.state = { ...base.state, ...opts.state ?? {} };
1216
+ for (const key of Object.keys(opts)) {
1217
+ if (typeof key === "string" && key.startsWith("on") && key.endsWith("Change") && typeof base[key] === "function" && typeof opts[key] === "function") {
1218
+ const internal = base[key];
1219
+ const external = opts[key];
1220
+ merged[key] = (...args) => {
1221
+ internal(...args);
1222
+ external(...args);
1223
+ };
1224
+ }
1225
+ }
1226
+ return merged;
1227
+ }
1228
+ function resolvePath(obj, path) {
1229
+ if (!path.includes(".")) {
1230
+ return obj == null ? void 0 : obj[path];
1231
+ }
1232
+ return path.split(".").reduce((acc, key) => {
1233
+ if (acc == null) return void 0;
1234
+ return acc[key];
1235
+ }, obj);
1236
+ }
1237
+ var customAggFns = {
1238
+ minMax: (_columnId, leafRows) => {
1239
+ const nums = leafRows.map((r) => Number(r.getValue(_columnId))).filter((n) => !Number.isNaN(n));
1240
+ if (nums.length === 0) return "";
1241
+ return `${Math.min(...nums)}\u2013${Math.max(...nums)}`;
1242
+ },
1243
+ median: (_columnId, leafRows) => {
1244
+ const nums = leafRows.map((r) => Number(r.getValue(_columnId))).filter((n) => !Number.isNaN(n)).sort((a, b) => a - b);
1245
+ if (nums.length === 0) return "";
1246
+ const mid = Math.floor(nums.length / 2);
1247
+ return nums.length % 2 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
1248
+ },
1249
+ unique: (_columnId, leafRows) => {
1250
+ const set = new Set(leafRows.map((r) => r.getValue(_columnId)));
1251
+ return Array.from(set).join(", ");
1252
+ },
1253
+ uniqueCount: (_columnId, leafRows) => {
1254
+ return new Set(leafRows.map((r) => r.getValue(_columnId))).size;
1255
+ }
1256
+ };
1257
+ var exactTextFilter = (row, columnId, value) => String(row.getValue(columnId) ?? "").toLowerCase() === String(value).toLowerCase();
1258
+ var exactTextCaseFilter = (row, columnId, value) => String(row.getValue(columnId) ?? "") === String(value);
1259
+ var equalsFilter = (row, columnId, value) => (
1260
+ // eslint-disable-next-line eqeqeq
1261
+ row.getValue(columnId) == value
1262
+ );
1263
+ function AnalyticalTable(props) {
1264
+ const {
1265
+ data,
1266
+ columns,
1267
+ getRowId,
1268
+ selectionMode: selectionModeProp,
1269
+ selectionBehavior = "rowSelector",
1270
+ selectable = false,
1271
+ selectedKeys,
1272
+ onSelectionChange,
1273
+ onRowSelect,
1274
+ onRowAction,
1275
+ onRowClick,
1276
+ onRowContextMenu,
1277
+ sortable = true,
1278
+ sorting: sortingProp,
1279
+ defaultSorting,
1280
+ onSortingChange,
1281
+ onSort,
1282
+ enableMultiSort = false,
1283
+ filterable = false,
1284
+ globalFilterValue,
1285
+ onFilter,
1286
+ loading,
1287
+ isLoading = false,
1288
+ loadingDelay = 0,
1289
+ alwaysShowBusyIndicator = false,
1290
+ showOverlay = false,
1291
+ skeletonRows = 8,
1292
+ emptyTitle = "Keine Daten",
1293
+ emptyDescription,
1294
+ noDataText,
1295
+ NoDataComponent,
1296
+ rowHeight = 44,
1297
+ headerRowHeight,
1298
+ visibleRows,
1299
+ renderRowSubComponent,
1300
+ subComponentsBehavior = "expandable",
1301
+ minRows,
1302
+ visibleRowCountMode = "fixed",
1303
+ overscanCount = 10,
1304
+ onTableScroll,
1305
+ maxHeight = 480,
1306
+ isTreeTable = false,
1307
+ subRowsKey = "subRows",
1308
+ onRowExpandChange,
1309
+ infiniteScroll = false,
1310
+ infiniteScrollThreshold = 20,
1311
+ onLoadMore,
1312
+ alternateRowColor = false,
1313
+ withRowHighlight = false,
1314
+ highlightField,
1315
+ withNavigationHighlight = false,
1316
+ markNavigatedRow,
1317
+ tableWidth,
1318
+ header,
1319
+ extension,
1320
+ glass,
1321
+ accessibleName,
1322
+ accessibleNameRef,
1323
+ className,
1324
+ "aria-label": ariaLabel,
1325
+ enableColumnResizing = false,
1326
+ retainColumnWidth = false,
1327
+ scaleWidthMode = "default",
1328
+ onAutoResize,
1329
+ enableColumnReorder = false,
1330
+ onColumnsReorder,
1331
+ enableGrouping = false,
1332
+ grouping: groupingProp,
1333
+ defaultGrouping,
1334
+ onGroupingChange,
1335
+ onGroup,
1336
+ enablePersonalization = false,
1337
+ columnVisibility: columnVisibilityProp,
1338
+ defaultColumnVisibility,
1339
+ onColumnVisibilityChange,
1340
+ columnOrder: columnOrderProp,
1341
+ defaultColumnOrder,
1342
+ onColumnOrderChange,
1343
+ columnPinning: columnPinningProp,
1344
+ defaultColumnPinning,
1345
+ onColumnPinningChange,
1346
+ reactTableOptions,
1347
+ onTableReady
1348
+ } = props;
1349
+ const selectionMode = selectionModeProp ?? (selectable ? "multiple" : "none");
1350
+ const showSelectColumn = selectionMode !== "none" && selectionBehavior !== "row" && selectionBehavior !== "rowOnly";
1351
+ const loadingActive = loading ?? isLoading;
1352
+ const [internalSorting, setInternalSorting] = useState(
1353
+ defaultSorting ?? []
1354
+ );
1355
+ const sorting = sortingProp ?? internalSorting;
1356
+ const setSorting = (next) => {
1357
+ if (sortingProp === void 0) setInternalSorting(next);
1358
+ const out = next.map((s) => ({ id: s.id, desc: s.desc }));
1359
+ onSortingChange?.(out);
1360
+ onSort?.(out);
1361
+ };
1362
+ const [columnFilters, setColumnFilters] = useState([]);
1363
+ const emitFilter = (next) => {
1364
+ onFilter?.(next.map((f) => ({ id: f.id, value: String(f.value ?? "") })));
1365
+ };
1366
+ const [internalGrouping, setInternalGrouping] = useState(defaultGrouping ?? []);
1367
+ const grouping = groupingProp ?? internalGrouping;
1368
+ const setGrouping = (next) => {
1369
+ if (groupingProp === void 0) setInternalGrouping(next);
1370
+ onGroupingChange?.(next);
1371
+ onGroup?.(next);
1372
+ };
1373
+ const [expanded, setExpanded] = useState(isTreeTable ? {} : true);
1374
+ const [internalVisibility, setInternalVisibility] = useState(
1375
+ defaultColumnVisibility ?? {}
1376
+ );
1377
+ const columnVisibility = columnVisibilityProp ?? internalVisibility;
1378
+ const setColumnVisibility = (next) => {
1379
+ if (columnVisibilityProp === void 0) setInternalVisibility(next);
1380
+ onColumnVisibilityChange?.(next);
1381
+ };
1382
+ const [internalOrder, setInternalOrder] = useState(defaultColumnOrder ?? []);
1383
+ const columnOrder = columnOrderProp ?? internalOrder;
1384
+ const setColumnOrder = (next) => {
1385
+ if (columnOrderProp === void 0) setInternalOrder(next);
1386
+ onColumnOrderChange?.(next);
1387
+ };
1388
+ const [columnSizing, setColumnSizing] = useState({});
1389
+ const seededPinning = useMemo(() => {
1390
+ if (defaultColumnPinning) {
1391
+ return { left: defaultColumnPinning.left ?? [], right: defaultColumnPinning.right ?? [] };
1392
+ }
1393
+ const left = [];
1394
+ const right = [];
1395
+ for (const col of columns) {
1396
+ const id = col.id ?? col.accessorKey ?? String(col.header);
1397
+ if (col.defaultPinned === "left") left.push(id);
1398
+ else if (col.defaultPinned === "right") right.push(id);
1399
+ }
1400
+ return { left, right };
1401
+ }, []);
1402
+ const [internalPinning, setInternalPinning] = useState(seededPinning);
1403
+ const columnPinning = columnPinningProp ? { left: columnPinningProp.left ?? [], right: columnPinningProp.right ?? [] } : internalPinning;
1404
+ const setColumnPinning = (next) => {
1405
+ if (columnPinningProp === void 0) setInternalPinning(next);
1406
+ onColumnPinningChange?.({ left: next.left, right: next.right });
1407
+ };
1408
+ const [internalSelection, setInternalSelection] = useState({});
1409
+ const rowSelection = useMemo(() => {
1410
+ if (selectedKeys === void 0) return internalSelection;
1411
+ const next = {};
1412
+ selectedKeys.forEach((k) => {
1413
+ next[k] = true;
1414
+ });
1415
+ return next;
1416
+ }, [selectedKeys, internalSelection]);
1417
+ const containerRef = useRef(null);
1418
+ const [measuredWidth, setMeasuredWidth] = useState(tableWidth);
1419
+ useEffect(() => {
1420
+ if (tableWidth !== void 0) {
1421
+ setMeasuredWidth(tableWidth);
1422
+ return;
1423
+ }
1424
+ const el = containerRef.current;
1425
+ if (!el) return;
1426
+ const measure = (w) => {
1427
+ if (w > 0) setMeasuredWidth(w);
1428
+ };
1429
+ measure(el.getBoundingClientRect().width);
1430
+ if (typeof ResizeObserver === "undefined") return;
1431
+ let prevWidth = el.getBoundingClientRect().width;
1432
+ const ro = new ResizeObserver((entries) => {
1433
+ for (const e of entries) {
1434
+ const w = e.contentRect?.width ?? e.target.getBoundingClientRect().width;
1435
+ measure(w);
1436
+ if (!retainColumnWidth && w !== prevWidth) {
1437
+ setColumnSizing((prev) => Object.keys(prev).length ? {} : prev);
1438
+ }
1439
+ prevWidth = w;
1440
+ }
1441
+ });
1442
+ ro.observe(el);
1443
+ return () => ro.disconnect();
1444
+ }, [tableWidth, retainColumnWidth]);
1445
+ const effectiveWidth = tableWidth ?? measuredWidth;
1446
+ const hasPopIns = columns.some((c) => c.responsivePopIn);
1447
+ const popInColumnIds = useMemo(() => {
1448
+ if (!hasPopIns || effectiveWidth === void 0) return /* @__PURE__ */ new Set();
1449
+ const ids = /* @__PURE__ */ new Set();
1450
+ for (const col of columns) {
1451
+ if (!col.responsivePopIn) continue;
1452
+ const threshold = col.responsiveMinWidth ?? 600;
1453
+ if (effectiveWidth < threshold) ids.add(col.id ?? col.accessorKey ?? String(col.header));
1454
+ }
1455
+ return ids;
1456
+ }, [columns, effectiveWidth, hasPopIns]);
1457
+ const tableColumns = useMemo(() => {
1458
+ const defs = [];
1459
+ if (showSelectColumn) {
1460
+ defs.push({
1461
+ id: SELECT_COL_ID,
1462
+ enableSorting: false,
1463
+ enableColumnFilter: false,
1464
+ enableResizing: false,
1465
+ meta: { align: "start", width: "44px", isSelect: true },
1466
+ header: ({ table: table2 }) => /* @__PURE__ */ jsx(
1467
+ Checkbox,
1468
+ {
1469
+ "aria-label": "Alle Zeilen ausw\xE4hlen",
1470
+ isSelected: table2.getIsAllRowsSelected(),
1471
+ isIndeterminate: table2.getIsSomeRowsSelected(),
1472
+ onChange: (v) => table2.toggleAllRowsSelected(v)
1473
+ }
1474
+ ),
1475
+ cell: ({ row }) => selectionMode === "single" ? /* @__PURE__ */ jsx(
1476
+ "input",
1477
+ {
1478
+ type: "radio",
1479
+ "aria-label": "Zeile ausw\xE4hlen",
1480
+ checked: row.getIsSelected(),
1481
+ onChange: () => row.toggleSelected(true)
1482
+ }
1483
+ ) : /* @__PURE__ */ jsx(
1484
+ Checkbox,
1485
+ {
1486
+ "aria-label": "Zeile ausw\xE4hlen",
1487
+ isSelected: row.getIsSelected(),
1488
+ onChange: (v) => row.toggleSelected(v)
1489
+ }
1490
+ )
1491
+ });
1492
+ }
1493
+ columns.forEach((col, colIdx) => {
1494
+ const id = col.id ?? col.accessorKey ?? String(col.header);
1495
+ const accessorFn = col.accessor ?? (col.accessorKey ? (row) => resolvePath(row, col.accessorKey) : void 0);
1496
+ const sortAllowed = col.sortable !== false && col.disableSortBy !== true && sortable !== false && accessorFn !== void 0;
1497
+ const filterAllowed = (col.filterable ?? filterable) === true && col.disableFilters !== true && accessorFn !== void 0;
1498
+ const isTreeCol = isTreeTable && colIdx === 0;
1499
+ const aggSpec = col.aggregate;
1500
+ const isCustomNamedAgg = typeof aggSpec === "string" && (aggSpec === "minMax" || aggSpec === "median" || aggSpec === "unique" || aggSpec === "uniqueCount");
1501
+ const def = {
1502
+ id,
1503
+ accessorFn: accessorFn ?? (() => void 0),
1504
+ header: () => col.header,
1505
+ enableSorting: sortAllowed,
1506
+ sortingFn: col.sortType ?? "auto",
1507
+ sortDescFirst: col.sortDescFirst,
1508
+ sortUndefined: col.sortInverted ? -1 : void 0,
1509
+ invertSorting: col.sortInverted ?? void 0,
1510
+ enableColumnFilter: filterAllowed,
1511
+ enableGlobalFilter: col.disableGlobalFilter ? false : void 0,
1512
+ filterFn: col.filter === "exactText" ? exactTextFilter : col.filter === "exactTextCase" ? exactTextCaseFilter : col.filter === "equals" ? equalsFilter : "includesString",
1513
+ enableHiding: col.canHide !== false,
1514
+ enablePinning: !!col.canPin,
1515
+ enableResizing: enableColumnResizing && col.disableResizing !== true,
1516
+ minSize: col.minWidth ?? 60,
1517
+ maxSize: col.maxWidth ?? Number.MAX_SAFE_INTEGER,
1518
+ meta: {
1519
+ align: col.align ?? "start",
1520
+ vAlign: col.vAlign,
1521
+ width: col.width ?? "1fr",
1522
+ minWidth: col.minWidth,
1523
+ maxWidth: col.maxWidth,
1524
+ isTree: isTreeCol,
1525
+ headerTooltip: col.headerTooltip,
1526
+ headerLabel: col.headerLabel,
1527
+ cellLabel: col.cellLabel,
1528
+ responsivePopIn: col.responsivePopIn,
1529
+ responsiveMinWidth: col.responsiveMinWidth,
1530
+ popinDisplay: col.popinDisplay,
1531
+ autoResizable: col.autoResizable,
1532
+ renderFilter: col.Filter,
1533
+ renderHeaderPopover: col.Popover
1534
+ },
1535
+ cell: col.cellRender ? ({ row }) => col.cellRender(row.original) : ({ getValue }) => {
1536
+ const v = getValue();
1537
+ return v === null || v === void 0 ? "" : v;
1538
+ }
1539
+ };
1540
+ if (aggSpec) {
1541
+ if (typeof aggSpec === "function") {
1542
+ def.aggregationFn = (_colId, leafRows) => aggSpec(
1543
+ leafRows.map((r) => col.aggregateValue ? col.aggregateValue(r.original) : r.getValue(id)),
1544
+ leafRows.map((r) => r.original)
1545
+ );
1546
+ } else if (col.aggregateValue) {
1547
+ const resolveAgg = col.aggregateValue;
1548
+ def.aggregationFn = (_colId, leafRows) => {
1549
+ const values = leafRows.map((r) => resolveAgg(r.original));
1550
+ const nums = values.map((v) => Number(v)).filter((n) => !Number.isNaN(n));
1551
+ switch (aggSpec) {
1552
+ case "sum":
1553
+ return nums.reduce((a, b) => a + b, 0);
1554
+ case "avg":
1555
+ return nums.length ? nums.reduce((a, b) => a + b, 0) / nums.length : "";
1556
+ case "min":
1557
+ return nums.length ? Math.min(...nums) : "";
1558
+ case "max":
1559
+ return nums.length ? Math.max(...nums) : "";
1560
+ case "count":
1561
+ return leafRows.length;
1562
+ case "minMax":
1563
+ return nums.length ? `${Math.min(...nums)}\u2013${Math.max(...nums)}` : "";
1564
+ case "median": {
1565
+ const s = [...nums].sort((a, b) => a - b);
1566
+ if (!s.length) return "";
1567
+ const mid = Math.floor(s.length / 2);
1568
+ return s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2;
1569
+ }
1570
+ case "unique":
1571
+ return Array.from(new Set(values)).join(", ");
1572
+ case "uniqueCount":
1573
+ return new Set(values).size;
1574
+ default:
1575
+ return nums.reduce((a, b) => a + b, 0);
1576
+ }
1577
+ };
1578
+ } else if (isCustomNamedAgg) {
1579
+ def.aggregationFn = aggSpec;
1580
+ } else {
1581
+ def.aggregationFn = aggSpec === "avg" ? "mean" : aggSpec;
1582
+ }
1583
+ def.aggregatedCell = ({ getValue, row }) => {
1584
+ const value = getValue();
1585
+ if (col.aggregatedCellRender) {
1586
+ return col.aggregatedCellRender({ value, rows: row.getLeafRows().map((r) => r.original) });
1587
+ }
1588
+ return value === null || value === void 0 ? "" : value;
1589
+ };
1590
+ }
1591
+ defs.push(def);
1592
+ });
1593
+ return defs;
1594
+ }, [columns, showSelectColumn, selectionMode, sortable, filterable, enableColumnResizing, isTreeTable]);
1595
+ const getSubRows = useMemo(() => {
1596
+ if (!isTreeTable) return void 0;
1597
+ return (row) => row[subRowsKey];
1598
+ }, [isTreeTable, subRowsKey]);
1599
+ const baseOptions = {
1600
+ data,
1601
+ columns: tableColumns,
1602
+ state: {
1603
+ sorting,
1604
+ rowSelection,
1605
+ grouping,
1606
+ expanded,
1607
+ columnVisibility,
1608
+ columnOrder,
1609
+ columnPinning,
1610
+ columnSizing,
1611
+ columnFilters,
1612
+ ...globalFilterValue !== void 0 ? { globalFilter: globalFilterValue } : {}
1613
+ },
1614
+ aggregationFns: customAggFns,
1615
+ globalFilterFn: "includesString",
1616
+ enableMultiSort,
1617
+ onSortingChange: (updater) => setSorting(typeof updater === "function" ? updater(sorting) : updater),
1618
+ onColumnFiltersChange: (updater) => {
1619
+ setColumnFilters((prev) => {
1620
+ const next = typeof updater === "function" ? updater(prev) : updater;
1621
+ emitFilter(next);
1622
+ return next;
1623
+ });
1624
+ },
1625
+ enableRowSelection: selectionMode !== "none",
1626
+ enableMultiRowSelection: selectionMode === "multiple",
1627
+ onRowSelectionChange: (updater) => {
1628
+ const next = typeof updater === "function" ? updater(rowSelection) : updater;
1629
+ if (selectedKeys === void 0) setInternalSelection(next);
1630
+ const keys = new Set(Object.keys(next).filter((k) => next[k]));
1631
+ onSelectionChange?.(keys);
1632
+ },
1633
+ enableGrouping,
1634
+ onGroupingChange: (u) => setGrouping(typeof u === "function" ? u(grouping) : u),
1635
+ onExpandedChange: setExpanded,
1636
+ enableHiding: true,
1637
+ enablePinning: true,
1638
+ enableColumnResizing,
1639
+ columnResizeMode: "onChange",
1640
+ onColumnSizingChange: setColumnSizing,
1641
+ onColumnVisibilityChange: (u) => setColumnVisibility(typeof u === "function" ? u(columnVisibility) : u),
1642
+ onColumnOrderChange: (u) => setColumnOrder(typeof u === "function" ? u(columnOrder) : u),
1643
+ onColumnPinningChange: (u) => setColumnPinning(typeof u === "function" ? u(columnPinning) : u),
1644
+ getRowId: getRowId ? (row, index) => getRowId(row, index) : void 0,
1645
+ getSubRows,
1646
+ getCoreRowModel: getCoreRowModel(),
1647
+ getSortedRowModel: getSortedRowModel(),
1648
+ getGroupedRowModel: getGroupedRowModel(),
1649
+ getExpandedRowModel: getExpandedRowModel(),
1650
+ getFilteredRowModel: getFilteredRowModel()
1651
+ };
1652
+ const table = useReactTable(
1653
+ reactTableOptions ? mergeTableOptions(baseOptions, reactTableOptions) : baseOptions
1654
+ );
1655
+ const readyRef = useRef(false);
1656
+ useEffect(() => {
1657
+ if (!readyRef.current && onTableReady) {
1658
+ readyRef.current = true;
1659
+ onTableReady(table);
1660
+ }
1661
+ }, [table, onTableReady]);
1662
+ const rows = table.getRowModel().rows;
1663
+ const leafColumns = table.getVisibleLeafColumns();
1664
+ const renderedLeafColumns = useMemo(
1665
+ () => leafColumns.filter((c) => !popInColumnIds.has(c.id)),
1666
+ [leafColumns, popInColumnIds]
1667
+ );
1668
+ const gridTemplate = useMemo(() => {
1669
+ const tracks = renderedLeafColumns.map((c) => {
1670
+ const meta = c.columnDef.meta;
1671
+ const sized = columnSizing[c.id];
1672
+ if (enableColumnResizing && sized) return `${sized}px`;
1673
+ const base = meta?.width ?? "1fr";
1674
+ if (scaleWidthMode === "grow" && !meta?.isSelect) {
1675
+ const min = meta?.minWidth ? `${meta.minWidth}px` : base.includes("px") ? base : "120px";
1676
+ return `minmax(${min}, 1fr)`;
1677
+ }
1678
+ if (meta?.minWidth || meta?.maxWidth) {
1679
+ const min = meta.minWidth ? `${meta.minWidth}px` : "0";
1680
+ const max = meta.maxWidth ? `${meta.maxWidth}px` : base;
1681
+ return `minmax(${min}, ${max})`;
1682
+ }
1683
+ return base;
1684
+ });
1685
+ if (withRowHighlight) tracks.unshift(HIGHLIGHT_TRACK);
1686
+ if (withNavigationHighlight) tracks.push(NAV_TRACK);
1687
+ return tracks.join(" ");
1688
+ }, [renderedLeafColumns, columnSizing, enableColumnResizing, scaleWidthMode, withRowHighlight, withNavigationHighlight]);
1689
+ const totalColumnCount = renderedLeafColumns.length + (withRowHighlight ? 1 : 0) + (withNavigationHighlight ? 1 : 0);
1690
+ const scrollRef = useRef(null);
1691
+ const handleAutoResize = useCallback(
1692
+ (columnId) => {
1693
+ const grid = scrollRef.current;
1694
+ if (!grid) return;
1695
+ const colIdx = table.getVisibleLeafColumns().findIndex((c) => c.id === columnId);
1696
+ if (colIdx < 0) return;
1697
+ const headerCell = grid.querySelector(
1698
+ `.prn-th:nth-of-type(${colIdx + 1})`
1699
+ );
1700
+ const bodyCells = grid.querySelectorAll(`[data-colidx="${colIdx}"]`);
1701
+ let max = 0;
1702
+ const consider = (el) => {
1703
+ if (!el) return;
1704
+ const w = Math.max(el.scrollWidth, el.getBoundingClientRect().width);
1705
+ if (w > max) max = w;
1706
+ };
1707
+ consider(headerCell);
1708
+ bodyCells.forEach((c) => consider(c));
1709
+ const col = table.getColumn(columnId);
1710
+ const minSize = col?.columnDef.minSize ?? 60;
1711
+ const width = Math.max(minSize, Math.round(max) + 16);
1712
+ setColumnSizing((prev) => ({ ...prev, [columnId]: width }));
1713
+ onAutoResize?.({ columnId, width });
1714
+ },
1715
+ [table, onAutoResize]
1716
+ );
1717
+ const virtualizer = useVirtualizer({
1718
+ count: rows.length,
1719
+ getScrollElement: () => scrollRef.current,
1720
+ estimateSize: () => rowHeight,
1721
+ overscan: overscanCount
1722
+ });
1723
+ const virtualRows = virtualizer.getVirtualItems();
1724
+ const totalSize = virtualizer.getTotalSize();
1725
+ const paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
1726
+ const paddingBottom = virtualRows.length > 0 ? totalSize - virtualRows[virtualRows.length - 1].end : 0;
1727
+ const colCount = renderedLeafColumns.length;
1728
+ const computedMaxHeight = useMemo(() => {
1729
+ if (visibleRows && visibleRowCountMode !== "auto") {
1730
+ return visibleRows * rowHeight;
1731
+ }
1732
+ return typeof maxHeight === "number" ? maxHeight : maxHeight;
1733
+ }, [visibleRows, visibleRowCountMode, rowHeight, maxHeight]);
1734
+ const emptyRowCount = useMemo(() => {
1735
+ if (loadingActive || rows.length === 0) return 0;
1736
+ const target = visibleRowCountMode === "autoWithEmptyRows" ? visibleRows ?? 0 : minRows ?? 0;
1737
+ return Math.max(0, target - rows.length);
1738
+ }, [loadingActive, rows.length, visibleRowCountMode, visibleRows, minRows]);
1739
+ const loadMoreLockRef = useRef(false);
1740
+ const handleScroll = useCallback(() => {
1741
+ const el = scrollRef.current;
1742
+ if (!el) return;
1743
+ onTableScroll?.({ scrollTop: el.scrollTop, scrollLeft: el.scrollLeft });
1744
+ if (infiniteScroll && onLoadMore) {
1745
+ const remaining = el.scrollHeight - el.scrollTop - el.clientHeight;
1746
+ if (remaining <= infiniteScrollThreshold) {
1747
+ if (!loadMoreLockRef.current) {
1748
+ loadMoreLockRef.current = true;
1749
+ onLoadMore();
1750
+ }
1751
+ } else {
1752
+ loadMoreLockRef.current = false;
1753
+ }
1754
+ }
1755
+ }, [onTableScroll, infiniteScroll, onLoadMore, infiniteScrollThreshold]);
1756
+ const [activeCell, setActiveCell] = useState({ r: 0, c: 0 });
1757
+ const navColumnCount = colCount + (withNavigationHighlight ? 1 : 0);
1758
+ const renderedFirstIndex = virtualRows.length > 0 ? virtualRows[0].index : 0;
1759
+ const renderedLastIndex = virtualRows.length > 0 ? virtualRows[virtualRows.length - 1].index : 0;
1760
+ const activeRowRendered = activeCell.r >= renderedFirstIndex && activeCell.r <= renderedLastIndex;
1761
+ const tabbableRow = activeRowRendered ? activeCell.r : renderedFirstIndex;
1762
+ const onGridKeyDown = useCallback(
1763
+ (e) => {
1764
+ const key = e.key;
1765
+ if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(key)) return;
1766
+ e.preventDefault();
1767
+ setActiveCell((prev) => {
1768
+ let { r, c } = prev;
1769
+ if (key === "ArrowUp") r = Math.max(0, r - 1);
1770
+ else if (key === "ArrowDown") r = Math.min(rows.length - 1, r + 1);
1771
+ else if (key === "ArrowLeft") c = Math.max(0, c - 1);
1772
+ else if (key === "ArrowRight") c = Math.min(navColumnCount - 1, c + 1);
1773
+ else if (key === "Home") c = 0;
1774
+ else if (key === "End") c = navColumnCount - 1;
1775
+ const target = scrollRef.current?.querySelector(
1776
+ `[data-rowidx="${r}"][data-colidx="${c}"]`
1777
+ );
1778
+ target?.focus();
1779
+ return { r, c };
1780
+ });
1781
+ },
1782
+ [rows.length, navColumnCount]
1783
+ );
1784
+ const hasActiveFilters = columnFilters.length > 0 || (globalFilterValue ?? "") !== "";
1785
+ const noDataReason = data.length > 0 && hasActiveFilters ? "filtered" : "empty";
1786
+ const [showLoading, setShowLoading] = useState(loadingActive && loadingDelay === 0);
1787
+ useEffect(() => {
1788
+ if (!loadingActive) {
1789
+ setShowLoading(false);
1790
+ return;
1791
+ }
1792
+ if (loadingDelay === 0) {
1793
+ setShowLoading(true);
1794
+ return;
1795
+ }
1796
+ const t = setTimeout(() => setShowLoading(true), loadingDelay);
1797
+ return () => clearTimeout(t);
1798
+ }, [loadingActive, loadingDelay]);
1799
+ const titleId = accessibleNameRef ?? (header ? "prn-table-title" : void 0);
1800
+ const computedAriaLabel = ariaLabel ?? accessibleName;
1801
+ const showSkeleton = showLoading && !alwaysShowBusyIndicator && !showOverlay;
1802
+ const showBusy = showLoading && alwaysShowBusyIndicator && !showOverlay;
1803
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-table", className), ref: containerRef, children: [
1804
+ header && /* @__PURE__ */ jsx("div", { id: titleId, className: "prn-table-title", role: "heading", "aria-level": 2, children: header }),
1805
+ extension && /* @__PURE__ */ jsx("div", { className: "prn-table-extension", children: extension }),
1806
+ (enableGrouping || enablePersonalization) && /* @__PURE__ */ jsxs("div", { className: cx("prn-table-toolbar", glass && "prn-glass prn-glass-bar"), children: [
1807
+ enableGrouping && /* @__PURE__ */ jsx(GroupBar, { table, columns }),
1808
+ enablePersonalization && /* @__PURE__ */ jsx(ColumnMenu, { table, columns, onColumnsReorder })
1809
+ ] }),
1810
+ /* @__PURE__ */ jsxs("div", { className: "prn-table-viewport-wrap", children: [
1811
+ /* @__PURE__ */ jsx(
1812
+ "div",
1813
+ {
1814
+ ref: scrollRef,
1815
+ className: "prn-table-scroll",
1816
+ onScroll: handleScroll,
1817
+ style: { maxHeight: typeof computedMaxHeight === "number" ? `${computedMaxHeight}px` : computedMaxHeight },
1818
+ children: /* @__PURE__ */ jsxs(
1819
+ "div",
1820
+ {
1821
+ role: "grid",
1822
+ "aria-label": computedAriaLabel,
1823
+ "aria-labelledby": titleId && !computedAriaLabel ? titleId : void 0,
1824
+ "aria-rowcount": rows.length + 1,
1825
+ "aria-colcount": navColumnCount,
1826
+ "aria-busy": showBusy || void 0,
1827
+ className: cx(
1828
+ "prn-table-grid",
1829
+ alternateRowColor && "prn-table-zebra",
1830
+ withRowHighlight && "prn-table-has-highlight"
1831
+ ),
1832
+ style: { gridTemplateColumns: gridTemplate },
1833
+ onKeyDown: onGridKeyDown,
1834
+ children: [
1835
+ /* @__PURE__ */ jsxs("div", { role: "row", "aria-rowindex": 1, className: "prn-table-head", children: [
1836
+ withRowHighlight && /* @__PURE__ */ jsx("div", { className: "prn-th prn-th-highlight", "aria-hidden": true }),
1837
+ table.getHeaderGroups().map(
1838
+ (hg) => hg.headers.map((header2, hIdx) => {
1839
+ const meta = header2.column.columnDef.meta;
1840
+ const canSort = header2.column.getCanSort();
1841
+ const sorted = header2.column.getIsSorted();
1842
+ const sortIndex = header2.column.getSortIndex();
1843
+ const canFilter = header2.column.getCanFilter();
1844
+ const canResize = header2.column.getCanResize();
1845
+ const canReorder = enableColumnReorder && header2.column.id !== SELECT_COL_ID && !columns.find(
1846
+ (c) => (c.id ?? c.accessorKey ?? String(c.header)) === header2.column.id
1847
+ )?.disableDragAndDrop;
1848
+ const pin = pinStyle(header2.column);
1849
+ const popinHidden = popInColumnIds.has(header2.column.id);
1850
+ if (popinHidden) return null;
1851
+ return /* @__PURE__ */ jsxs(
1852
+ "div",
1853
+ {
1854
+ role: "columnheader",
1855
+ "aria-colindex": hIdx + 1,
1856
+ className: cx("prn-th", meta?.isSelect && "prn-th-select"),
1857
+ "data-align": meta?.align,
1858
+ "data-pinned": pin.pinned,
1859
+ style: headerRowHeight !== void 0 ? { ...pin.style, minHeight: `${headerRowHeight}px`, height: `${headerRowHeight}px` } : pin.style,
1860
+ title: meta?.headerTooltip,
1861
+ "aria-label": meta?.headerLabel,
1862
+ draggable: canReorder || void 0,
1863
+ onDragStart: canReorder ? (e) => e.dataTransfer.setData("text/plain", header2.column.id) : void 0,
1864
+ onDragOver: canReorder ? (e) => e.preventDefault() : void 0,
1865
+ onDrop: canReorder ? (e) => {
1866
+ e.preventDefault();
1867
+ const from = e.dataTransfer.getData("text/plain");
1868
+ const to = header2.column.id;
1869
+ if (!from || from === to) return;
1870
+ const current = table.getAllLeafColumns().map((c) => c.id);
1871
+ const fromIdx = current.indexOf(from);
1872
+ const toIdx = current.indexOf(to);
1873
+ if (fromIdx < 0 || toIdx < 0) return;
1874
+ const next = [...current];
1875
+ next.splice(fromIdx, 1);
1876
+ next.splice(toIdx, 0, from);
1877
+ table.setColumnOrder(next);
1878
+ onColumnsReorder?.(next);
1879
+ } : void 0,
1880
+ "data-sortable": canSort || void 0,
1881
+ "data-sorted": sorted ? "" : void 0,
1882
+ "aria-sort": sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : canSort ? "none" : void 0,
1883
+ tabIndex: canSort ? 0 : void 0,
1884
+ onClick: canSort ? (e) => header2.column.toggleSorting(void 0, enableMultiSort && e.shiftKey) : void 0,
1885
+ onKeyDown: canSort ? (e) => {
1886
+ if (e.key === "Enter" || e.key === " ") {
1887
+ e.preventDefault();
1888
+ header2.column.toggleSorting(void 0, enableMultiSort && e.shiftKey);
1889
+ }
1890
+ } : void 0,
1891
+ children: [
1892
+ !header2.isPlaceholder && flexRender(header2.column.columnDef.header, header2.getContext()),
1893
+ canSort && /* @__PURE__ */ jsxs("span", { className: "prn-th-sort", "data-active": sorted ? "" : void 0, "aria-hidden": true, children: [
1894
+ sorted === "desc" ? "\u25BE" : "\u25B4",
1895
+ enableMultiSort && sortIndex >= 0 && sorting.length > 1 && /* @__PURE__ */ jsx("sup", { className: "prn-th-sortidx", children: sortIndex + 1 })
1896
+ ] }),
1897
+ canFilter && /* @__PURE__ */ jsx(ColumnFilter, { column: header2.column }),
1898
+ meta?.renderHeaderPopover && /* @__PURE__ */ jsx(HeaderPopover, { render: meta.renderHeaderPopover }),
1899
+ canResize && /* @__PURE__ */ jsx(
1900
+ "span",
1901
+ {
1902
+ className: "prn-th-resizer",
1903
+ role: "separator",
1904
+ "aria-orientation": "vertical",
1905
+ "aria-label": "Spaltenbreite \xE4ndern",
1906
+ onMouseDown: header2.getResizeHandler(),
1907
+ onTouchStart: header2.getResizeHandler(),
1908
+ onClick: (e) => e.stopPropagation(),
1909
+ onDoubleClick: meta?.autoResizable ? (e) => {
1910
+ e.stopPropagation();
1911
+ handleAutoResize(header2.column.id);
1912
+ } : void 0,
1913
+ "data-autoresizable": meta?.autoResizable ? "" : void 0,
1914
+ "data-resizing": header2.column.getIsResizing() ? "" : void 0
1915
+ }
1916
+ )
1917
+ ]
1918
+ },
1919
+ header2.id
1920
+ );
1921
+ })
1922
+ ),
1923
+ withNavigationHighlight && /* @__PURE__ */ jsx("div", { role: "columnheader", "aria-colindex": navColumnCount, className: "prn-th prn-th-nav", "aria-label": "Navigation" })
1924
+ ] }),
1925
+ showSkeleton ? /* @__PURE__ */ jsx(
1926
+ SkeletonRows,
1927
+ {
1928
+ count: skeletonRows,
1929
+ leafColumns,
1930
+ popInIds: popInColumnIds,
1931
+ withRowHighlight,
1932
+ withNavigationHighlight
1933
+ }
1934
+ ) : showBusy ? /* @__PURE__ */ jsx("div", { className: "prn-table-busy", role: "row", children: /* @__PURE__ */ jsxs("div", { className: "prn-busy-indicator", role: "status", "aria-label": "L\xE4dt", children: [
1935
+ /* @__PURE__ */ jsx("span", { className: "prn-busy-dot" }),
1936
+ /* @__PURE__ */ jsx("span", { className: "prn-busy-dot" }),
1937
+ /* @__PURE__ */ jsx("span", { className: "prn-busy-dot" })
1938
+ ] }) }) : rows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "prn-table-empty", role: "row", children: NoDataComponent ? NoDataComponent({ reason: noDataReason }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1939
+ /* @__PURE__ */ jsx("div", { className: "prn-table-empty-title", children: noDataText ?? emptyTitle }),
1940
+ emptyDescription && /* @__PURE__ */ jsx("div", { className: "prn-table-empty-desc", children: emptyDescription })
1941
+ ] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1942
+ paddingTop > 0 && /* @__PURE__ */ jsx(Spacer, { height: paddingTop, span: totalColumnCount }),
1943
+ virtualRows.map((vr) => {
1944
+ const row = rows[vr.index];
1945
+ if (!row) return null;
1946
+ if (row.getIsGrouped()) {
1947
+ return /* @__PURE__ */ jsx(
1948
+ GroupRow,
1949
+ {
1950
+ row,
1951
+ rowIndex: vr.index,
1952
+ gridSpan: totalColumnCount,
1953
+ leafColumns
1954
+ },
1955
+ row.id
1956
+ );
1957
+ }
1958
+ return /* @__PURE__ */ jsx(
1959
+ TableRow,
1960
+ {
1961
+ table,
1962
+ row,
1963
+ rowIndex: vr.index,
1964
+ rowAriaIndex: vr.index + 2,
1965
+ activeCell,
1966
+ tabbableRow,
1967
+ setActiveCell,
1968
+ selectionMode,
1969
+ selectionBehavior,
1970
+ isTreeTable,
1971
+ onRowAction,
1972
+ onRowClick,
1973
+ onRowContextMenu,
1974
+ onRowSelect,
1975
+ onRowExpandChange,
1976
+ withRowHighlight,
1977
+ highlightField,
1978
+ withNavigationHighlight,
1979
+ markNavigatedRow,
1980
+ navColIndex: navColumnCount,
1981
+ gridColumnCount: totalColumnCount,
1982
+ popInIds: popInColumnIds,
1983
+ columns,
1984
+ renderRowSubComponent,
1985
+ subComponentsBehavior
1986
+ },
1987
+ row.id
1988
+ );
1989
+ }),
1990
+ paddingBottom > 0 && /* @__PURE__ */ jsx(Spacer, { height: paddingBottom, span: totalColumnCount }),
1991
+ emptyRowCount > 0 && Array.from({ length: emptyRowCount }).map((_, i) => /* @__PURE__ */ jsx("div", { role: "row", "aria-hidden": true, className: "prn-table-row prn-table-row-empty", children: Array.from({ length: totalColumnCount }).map((__, c) => /* @__PURE__ */ jsx("div", { className: "prn-td prn-td-empty" }, c)) }, `empty-${i}`))
1992
+ ] })
1993
+ ]
1994
+ }
1995
+ )
1996
+ }
1997
+ ),
1998
+ showOverlay && loadingActive && /* @__PURE__ */ jsx("div", { className: "prn-table-overlay", role: "status", "aria-label": "L\xE4dt", children: /* @__PURE__ */ jsxs("div", { className: "prn-busy-indicator", children: [
1999
+ /* @__PURE__ */ jsx("span", { className: "prn-busy-dot" }),
2000
+ /* @__PURE__ */ jsx("span", { className: "prn-busy-dot" }),
2001
+ /* @__PURE__ */ jsx("span", { className: "prn-busy-dot" })
2002
+ ] }) })
2003
+ ] })
2004
+ ] });
2005
+ }
2006
+ function Spacer({ height, span }) {
2007
+ return /* @__PURE__ */ jsx("div", { "aria-hidden": true, style: { gridColumn: `1 / ${span + 1}`, height } });
2008
+ }
2009
+ function ColumnFilter({ column }) {
2010
+ const value = column.getFilterValue() ?? "";
2011
+ const renderFilter = column.columnDef.meta?.renderFilter;
2012
+ const setValue = (v) => column.setFilterValue(v || void 0);
2013
+ return /* @__PURE__ */ jsx("span", { className: "prn-th-filter", onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(DialogTrigger, { children: [
2014
+ /* @__PURE__ */ jsx(
2015
+ Button,
2016
+ {
2017
+ variant: "plain",
2018
+ "aria-label": "Spalte filtern",
2019
+ className: cx("prn-th-filter-btn", value && "prn-th-filter-btn-active"),
2020
+ children: "\u2315"
2021
+ }
2022
+ ),
2023
+ /* @__PURE__ */ jsx(Popover2, { className: "prn-th-filter-popover", children: /* @__PURE__ */ jsx("div", { className: "prn-th-filter-body", children: renderFilter ? renderFilter({ value, setValue }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2024
+ /* @__PURE__ */ jsx(
2025
+ TextField,
2026
+ {
2027
+ "aria-label": "Filterwert",
2028
+ label: "Filtern",
2029
+ value,
2030
+ onChange: (v) => setValue(v)
2031
+ }
2032
+ ),
2033
+ value && /* @__PURE__ */ jsx(Button, { variant: "plain", onPress: () => column.setFilterValue(void 0), children: "Zur\xFCcksetzen" })
2034
+ ] }) }) })
2035
+ ] }) });
2036
+ }
2037
+ function HeaderPopover({ render }) {
2038
+ return /* @__PURE__ */ jsx("span", { className: "prn-th-popover", onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(DialogTrigger, { children: [
2039
+ /* @__PURE__ */ jsx(Button, { variant: "plain", "aria-label": "Spalteninfo", className: "prn-th-popover-btn", children: "\u22EF" }),
2040
+ /* @__PURE__ */ jsx(Popover2, { className: "prn-th-popover-content", children: render() })
2041
+ ] }) });
2042
+ }
2043
+ function TableRow({
2044
+ table,
2045
+ row,
2046
+ rowIndex,
2047
+ rowAriaIndex,
2048
+ activeCell,
2049
+ tabbableRow,
2050
+ setActiveCell,
2051
+ selectionMode,
2052
+ selectionBehavior,
2053
+ isTreeTable,
2054
+ onRowAction,
2055
+ onRowClick,
2056
+ onRowContextMenu,
2057
+ onRowSelect,
2058
+ onRowExpandChange,
2059
+ withRowHighlight,
2060
+ highlightField,
2061
+ withNavigationHighlight,
2062
+ markNavigatedRow,
2063
+ navColIndex,
2064
+ gridColumnCount,
2065
+ popInIds,
2066
+ columns,
2067
+ renderRowSubComponent,
2068
+ subComponentsBehavior
2069
+ }) {
2070
+ const [hovered, setHovered] = useState(false);
2071
+ const selectionSelectsRow = selectionMode !== "none" && (selectionBehavior === "row" || selectionBehavior === "rowOnly");
2072
+ const hasSubComponent = !!renderRowSubComponent;
2073
+ const subAlwaysVisible = hasSubComponent && subComponentsBehavior === "visible";
2074
+ const [subOpen, setSubOpen] = useState(subAlwaysVisible);
2075
+ const subVisible = subAlwaysVisible || subOpen;
2076
+ const interactive = !!onRowAction || !!onRowClick || selectionSelectsRow;
2077
+ const doSelect = () => {
2078
+ const wasSelected = row.getIsSelected();
2079
+ row.toggleSelected(!wasSelected);
2080
+ if (onRowSelect) {
2081
+ const selectedKeys = /* @__PURE__ */ new Set();
2082
+ if (selectionMode === "single") {
2083
+ if (!wasSelected) selectedKeys.add(row.id);
2084
+ } else {
2085
+ for (const r of table.getSelectedRowModel().flatRows) selectedKeys.add(r.id);
2086
+ if (wasSelected) selectedKeys.delete(row.id);
2087
+ else selectedKeys.add(row.id);
2088
+ }
2089
+ onRowSelect({ row: row.original, selected: !wasSelected, selectedKeys });
2090
+ }
2091
+ };
2092
+ const handleClick = (e) => {
2093
+ onRowClick?.({ row: row.original, event: e });
2094
+ onRowAction?.(row.original);
2095
+ if (selectionSelectsRow) doSelect();
2096
+ };
2097
+ const highlight = withRowHighlight && highlightField ? highlightField(row.original) : void 0;
2098
+ const navigated = withNavigationHighlight && markNavigatedRow ? markNavigatedRow(row.original) : false;
2099
+ const rowElement = /* @__PURE__ */ jsxs(
2100
+ "div",
2101
+ {
2102
+ role: "row",
2103
+ "aria-rowindex": rowAriaIndex,
2104
+ "aria-selected": selectionMode !== "none" ? row.getIsSelected() : void 0,
2105
+ "aria-expanded": hasSubComponent && !subAlwaysVisible ? subVisible : void 0,
2106
+ "data-key": row.id,
2107
+ "data-zebra": rowIndex % 2 === 1 ? "" : void 0,
2108
+ "data-highlight": highlight,
2109
+ className: "prn-table-row",
2110
+ "data-interactive": interactive ? "" : void 0,
2111
+ "data-selected": row.getIsSelected() ? "" : void 0,
2112
+ "data-hovered": hovered ? "" : void 0,
2113
+ onMouseEnter: interactive ? () => setHovered(true) : void 0,
2114
+ onMouseLeave: interactive ? () => setHovered(false) : void 0,
2115
+ onClick: interactive ? handleClick : void 0,
2116
+ onContextMenu: onRowContextMenu ? (e) => {
2117
+ e.preventDefault();
2118
+ onRowContextMenu({ row: row.original, event: e });
2119
+ } : void 0,
2120
+ children: [
2121
+ withRowHighlight && /* @__PURE__ */ jsx("span", { className: "prn-row-highlight", "data-state": highlight ?? "none", "aria-hidden": true }),
2122
+ row.getVisibleCells().filter((cell) => !popInIds.has(cell.column.id)).map((cell, cellIdx) => {
2123
+ const meta = cell.column.columnDef.meta;
2124
+ const pin = pinStyle(cell.column);
2125
+ const isTreeCell = isTreeTable && meta?.isTree;
2126
+ const canExpand = isTreeCell && row.getCanExpand();
2127
+ const isActive = activeCell.r === rowIndex && activeCell.c === cellIdx;
2128
+ const popInCells = cellIdx === 0 && popInIds.size > 0 ? row.getVisibleCells().filter((c) => popInIds.has(c.column.id)) : [];
2129
+ return /* @__PURE__ */ jsxs(
2130
+ "div",
2131
+ {
2132
+ role: "gridcell",
2133
+ "aria-colindex": cellIdx + 1,
2134
+ "data-rowidx": rowIndex,
2135
+ "data-colidx": cellIdx,
2136
+ tabIndex: isActive ? 0 : -1,
2137
+ onFocus: () => setActiveCell({ r: rowIndex, c: cellIdx }),
2138
+ className: cx("prn-td", meta?.isSelect && "prn-td-select"),
2139
+ "data-align": meta?.align,
2140
+ "data-valign": meta?.vAlign,
2141
+ "data-pinned": pin.pinned,
2142
+ "aria-label": meta?.cellLabel,
2143
+ style: { ...pin.style, ...isTreeCell ? { paddingLeft: `${row.depth * 16 + 12}px` } : null },
2144
+ onKeyDown: canExpand ? (e) => {
2145
+ if (e.key === " ") {
2146
+ e.preventDefault();
2147
+ const next = !row.getIsExpanded();
2148
+ row.toggleExpanded();
2149
+ onRowExpandChange?.({ row: row.original, expanded: next });
2150
+ }
2151
+ } : void 0,
2152
+ children: [
2153
+ canExpand && /* @__PURE__ */ jsx(
2154
+ "button",
2155
+ {
2156
+ type: "button",
2157
+ className: "prn-tree-chevron",
2158
+ "aria-label": row.getIsExpanded() ? "Zusammenklappen" : "Aufklappen",
2159
+ "aria-expanded": row.getIsExpanded(),
2160
+ onClick: (e) => {
2161
+ e.stopPropagation();
2162
+ const next = !row.getIsExpanded();
2163
+ row.toggleExpanded();
2164
+ onRowExpandChange?.({ row: row.original, expanded: next });
2165
+ },
2166
+ children: row.getIsExpanded() ? "\u25BE" : "\u25B8"
2167
+ }
2168
+ ),
2169
+ cellIdx === 0 && hasSubComponent && !subAlwaysVisible && /* @__PURE__ */ jsx(
2170
+ "button",
2171
+ {
2172
+ type: "button",
2173
+ className: "prn-tree-chevron prn-subcomponent-toggle",
2174
+ "aria-label": subVisible ? "Details ausblenden" : "Details anzeigen",
2175
+ "aria-expanded": subVisible,
2176
+ onClick: (e) => {
2177
+ e.stopPropagation();
2178
+ setSubOpen((o) => !o);
2179
+ },
2180
+ children: subVisible ? "\u25BE" : "\u25B8"
2181
+ }
2182
+ ),
2183
+ /* @__PURE__ */ jsx("span", { className: "prn-td-content", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }),
2184
+ popInCells.length > 0 && /* @__PURE__ */ jsx("span", { className: "prn-popin", children: popInCells.map((pc) => {
2185
+ const pcMeta = pc.column.columnDef.meta;
2186
+ const colDef = columns.find(
2187
+ (c) => (c.id ?? c.accessorKey ?? String(c.header)) === pc.column.id
2188
+ );
2189
+ return /* @__PURE__ */ jsxs(
2190
+ "span",
2191
+ {
2192
+ className: "prn-popin-item",
2193
+ "data-display": pcMeta?.popinDisplay ?? "block",
2194
+ children: [
2195
+ /* @__PURE__ */ jsxs("span", { className: "prn-popin-label", children: [
2196
+ colDef?.header,
2197
+ ":"
2198
+ ] }),
2199
+ " ",
2200
+ /* @__PURE__ */ jsx("span", { className: "prn-popin-value", children: flexRender(pc.column.columnDef.cell, pc.getContext()) })
2201
+ ]
2202
+ },
2203
+ pc.id
2204
+ );
2205
+ }) })
2206
+ ]
2207
+ },
2208
+ cell.id
2209
+ );
2210
+ }),
2211
+ withNavigationHighlight && /* @__PURE__ */ jsx(
2212
+ "div",
2213
+ {
2214
+ role: "gridcell",
2215
+ "aria-colindex": navColIndex,
2216
+ className: "prn-td prn-td-nav",
2217
+ "data-navigated": navigated ? "" : void 0,
2218
+ "aria-label": navigated ? "Navigiert" : void 0,
2219
+ children: /* @__PURE__ */ jsx("span", { className: "prn-nav-arrow", "aria-hidden": true, children: "\u203A" })
2220
+ }
2221
+ )
2222
+ ]
2223
+ }
2224
+ );
2225
+ if (!hasSubComponent || !subVisible) return rowElement;
2226
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2227
+ rowElement,
2228
+ /* @__PURE__ */ jsx(
2229
+ "div",
2230
+ {
2231
+ role: "row",
2232
+ className: "prn-table-subrow",
2233
+ "data-key": `${row.id}__sub`,
2234
+ "data-subcomponent": "",
2235
+ children: /* @__PURE__ */ jsx("div", { role: "gridcell", className: "prn-td prn-subcomponent", style: { gridColumn: `1 / ${gridColumnCount + 1}` }, children: renderRowSubComponent({ row: row.original }) })
2236
+ }
2237
+ )
2238
+ ] });
2239
+ }
2240
+ function GroupBar({ table, columns }) {
2241
+ const grouping = table.getState().grouping;
2242
+ const labelFor = (id) => {
2243
+ const col = columns.find((c) => (c.id ?? c.accessorKey ?? String(c.header)) === id);
2244
+ return col ? col.header : id;
2245
+ };
2246
+ const groupable = columns.filter((c) => c.groupable).map((c) => ({ id: c.id ?? c.accessorKey ?? String(c.header), header: c.header })).filter((c) => !grouping.includes(c.id));
2247
+ return /* @__PURE__ */ jsxs("div", { className: "prn-groupbar", role: "toolbar", "aria-label": "Gruppierung", children: [
2248
+ /* @__PURE__ */ jsx("span", { className: "prn-groupbar-label", children: "Gruppiert nach:" }),
2249
+ grouping.length === 0 && /* @__PURE__ */ jsx("span", { className: "prn-groupbar-empty", children: "\u2014" }),
2250
+ grouping.map((id) => /* @__PURE__ */ jsxs("span", { className: "prn-group-chip", children: [
2251
+ /* @__PURE__ */ jsx("span", { className: "prn-group-chip-label", children: labelFor(id) }),
2252
+ /* @__PURE__ */ jsx(
2253
+ "button",
2254
+ {
2255
+ type: "button",
2256
+ className: "prn-group-chip-remove",
2257
+ "aria-label": `${String(labelFor(id))} entfernen`,
2258
+ onClick: () => table.setGrouping((g) => g.filter((x) => x !== id)),
2259
+ children: "\xD7"
2260
+ }
2261
+ )
2262
+ ] }, id)),
2263
+ groupable.length > 0 && /* @__PURE__ */ jsx(Menu, { trigger: /* @__PURE__ */ jsx(Button, { variant: "plain", children: "+ Gruppieren" }), children: groupable.map((c) => /* @__PURE__ */ jsx(MenuItem, { onAction: () => table.setGrouping((g) => [...g, c.id]), children: c.header }, c.id)) })
2264
+ ] });
2265
+ }
2266
+ function ColumnMenu({
2267
+ table,
2268
+ columns,
2269
+ onColumnsReorder
2270
+ }) {
2271
+ const labelFor = (id) => {
2272
+ const col = columns.find((c) => (c.id ?? c.accessorKey ?? String(c.header)) === id);
2273
+ return col ? col.header : id;
2274
+ };
2275
+ const leaf = table.getAllLeafColumns().filter((c) => c.id !== SELECT_COL_ID);
2276
+ const order = leaf.map((c) => c.id);
2277
+ const move = (id, dir) => {
2278
+ const idx = order.indexOf(id);
2279
+ const next = idx + dir;
2280
+ if (next < 0 || next >= order.length) return;
2281
+ const reordered = [...order];
2282
+ [reordered[idx], reordered[next]] = [reordered[next], reordered[idx]];
2283
+ table.setColumnOrder(reordered);
2284
+ onColumnsReorder?.(reordered);
2285
+ };
2286
+ return /* @__PURE__ */ jsx("div", { className: "prn-colmenu", children: /* @__PURE__ */ jsxs(DialogTrigger, { children: [
2287
+ /* @__PURE__ */ jsxs(Button, { variant: "plain", "aria-label": "Spalten", children: [
2288
+ /* @__PURE__ */ jsx(Icon, { name: "settings", size: 15 }),
2289
+ " Spalten"
2290
+ ] }),
2291
+ /* @__PURE__ */ jsx(Popover2, { className: "prn-colmenu-popover", children: /* @__PURE__ */ jsx("ul", { className: "prn-colmenu-list", role: "group", "aria-label": "Spalten anpassen", children: leaf.map((col, i) => {
2292
+ const label = labelFor(col.id);
2293
+ const pinned = col.getIsPinned();
2294
+ return /* @__PURE__ */ jsxs("li", { className: "prn-colmenu-row", children: [
2295
+ col.getCanHide() ? /* @__PURE__ */ jsx(Checkbox, { isSelected: col.getIsVisible(), onChange: () => col.toggleVisibility(), children: label }) : /* @__PURE__ */ jsx("span", { className: "prn-colmenu-label", children: label }),
2296
+ /* @__PURE__ */ jsxs("span", { className: "prn-colmenu-actions", children: [
2297
+ /* @__PURE__ */ jsx(
2298
+ "button",
2299
+ {
2300
+ type: "button",
2301
+ className: "prn-colmenu-btn",
2302
+ "aria-label": `${String(label)} nach oben`,
2303
+ disabled: i === 0,
2304
+ onClick: () => move(col.id, -1),
2305
+ children: "\u2191"
2306
+ }
2307
+ ),
2308
+ /* @__PURE__ */ jsx(
2309
+ "button",
2310
+ {
2311
+ type: "button",
2312
+ className: "prn-colmenu-btn",
2313
+ "aria-label": `${String(label)} nach unten`,
2314
+ disabled: i === leaf.length - 1,
2315
+ onClick: () => move(col.id, 1),
2316
+ children: "\u2193"
2317
+ }
2318
+ ),
2319
+ col.getCanPin() && /* @__PURE__ */ jsxs(Fragment, { children: [
2320
+ /* @__PURE__ */ jsx(
2321
+ "button",
2322
+ {
2323
+ type: "button",
2324
+ className: "prn-colmenu-btn",
2325
+ "aria-label": `${String(label)} links pinnen`,
2326
+ "data-active": pinned === "left" ? "" : void 0,
2327
+ onClick: () => col.pin(pinned === "left" ? false : "left"),
2328
+ children: "\u21E4"
2329
+ }
2330
+ ),
2331
+ /* @__PURE__ */ jsx(
2332
+ "button",
2333
+ {
2334
+ type: "button",
2335
+ className: "prn-colmenu-btn",
2336
+ "aria-label": `${String(label)} rechts pinnen`,
2337
+ "data-active": pinned === "right" ? "" : void 0,
2338
+ onClick: () => col.pin(pinned === "right" ? false : "right"),
2339
+ children: "\u21E5"
2340
+ }
2341
+ )
2342
+ ] })
2343
+ ] })
2344
+ ] }, col.id);
2345
+ }) }) })
2346
+ ] }) });
2347
+ }
2348
+ function GroupRow({
2349
+ row,
2350
+ rowIndex,
2351
+ gridSpan,
2352
+ leafColumns
2353
+ }) {
2354
+ const expanded = row.getIsExpanded();
2355
+ const groupingColumnId = row.groupingColumnId ?? "";
2356
+ return /* @__PURE__ */ jsxs(
2357
+ "div",
2358
+ {
2359
+ role: "row",
2360
+ "aria-rowindex": rowIndex + 2,
2361
+ "aria-expanded": expanded,
2362
+ "data-group": "",
2363
+ "data-depth": row.depth,
2364
+ "data-index": rowIndex,
2365
+ className: "prn-table-group",
2366
+ tabIndex: 0,
2367
+ onClick: () => row.toggleExpanded(),
2368
+ onKeyDown: (e) => {
2369
+ if (e.key === "Enter" || e.key === " ") {
2370
+ e.preventDefault();
2371
+ row.toggleExpanded();
2372
+ }
2373
+ },
2374
+ style: { gridColumn: `1 / ${gridSpan + 1}`, paddingLeft: `${row.depth * 16 + 12}px` },
2375
+ children: [
2376
+ /* @__PURE__ */ jsx("span", { className: "prn-group-chevron", "aria-hidden": true, children: expanded ? "\u25BE" : "\u25B8" }),
2377
+ /* @__PURE__ */ jsx("span", { className: "prn-group-label", children: String(row.getGroupingValue(groupingColumnId)) }),
2378
+ /* @__PURE__ */ jsxs("span", { className: "prn-group-count", children: [
2379
+ "(",
2380
+ row.subRows.length,
2381
+ ")"
2382
+ ] }),
2383
+ /* @__PURE__ */ jsx("span", { className: "prn-group-aggs", children: leafColumns.filter((c) => c.columnDef.aggregatedCell && c.id !== groupingColumnId).map((c) => {
2384
+ const cell = row.getAllCells().find((cl) => cl.column.id === c.id);
2385
+ return cell ? /* @__PURE__ */ jsx("span", { className: "prn-group-agg", children: flexRender(c.columnDef.aggregatedCell, cell.getContext()) }, c.id) : null;
2386
+ }) })
2387
+ ]
2388
+ }
2389
+ );
2390
+ }
2391
+ function SkeletonRows({
2392
+ count,
2393
+ leafColumns,
2394
+ popInIds,
2395
+ withRowHighlight,
2396
+ withNavigationHighlight
2397
+ }) {
2398
+ return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: count }).map((_, r) => /* @__PURE__ */ jsxs("div", { role: "row", className: "prn-table-row", "aria-hidden": true, children: [
2399
+ withRowHighlight && /* @__PURE__ */ jsx("span", { className: "prn-row-highlight", "data-state": "none", "aria-hidden": true }),
2400
+ leafColumns.filter((c) => !popInIds.has(c.id)).map((c) => {
2401
+ const meta = c.columnDef.meta;
2402
+ return /* @__PURE__ */ jsx(
2403
+ "div",
2404
+ {
2405
+ className: cx("prn-td", meta?.isSelect && "prn-td-select"),
2406
+ "data-align": meta?.align,
2407
+ children: /* @__PURE__ */ jsx("span", { className: "prn-skeleton prn-skel-line" })
2408
+ },
2409
+ c.id
2410
+ );
2411
+ }),
2412
+ withNavigationHighlight && /* @__PURE__ */ jsx("div", { className: "prn-td prn-td-nav" })
2413
+ ] }, `skel-${r}`)) });
2414
+ }
2415
+ function FilterField({ label, children, className }) {
2416
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-filter-field", className), children: [
2417
+ label && /* @__PURE__ */ jsx("span", { className: "prn-filter-field-label", children: label }),
2418
+ /* @__PURE__ */ jsx("div", { className: "prn-filter-field-control", children })
2419
+ ] });
2420
+ }
2421
+ function FilterBar({
2422
+ children,
2423
+ moreFields,
2424
+ moreLabel = "Mehr Filter",
2425
+ activeFilters,
2426
+ onRemoveFilter,
2427
+ onClearAll,
2428
+ actions,
2429
+ className,
2430
+ "aria-label": ariaLabel = "Filter"
2431
+ }) {
2432
+ const hasActive = !!activeFilters && activeFilters.length > 0;
2433
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-filterbar", className), role: "search", "aria-label": ariaLabel, children: [
2434
+ /* @__PURE__ */ jsxs("div", { className: "prn-filterbar-row", children: [
2435
+ children,
2436
+ moreFields && /* @__PURE__ */ jsx(FilterField, { label: "\xA0", children: /* @__PURE__ */ jsxs(DialogTrigger, { children: [
2437
+ /* @__PURE__ */ jsx(Button, { variant: "tinted", children: moreLabel }),
2438
+ /* @__PURE__ */ jsx(Popover2, { placement: "bottom start", children: /* @__PURE__ */ jsx("div", { className: "prn-filter-more", children: moreFields }) })
2439
+ ] }) }),
2440
+ actions && /* @__PURE__ */ jsxs(Fragment, { children: [
2441
+ /* @__PURE__ */ jsx("span", { className: "prn-filterbar-spacer" }),
2442
+ /* @__PURE__ */ jsx("div", { className: "prn-filterbar-actions", children: actions })
2443
+ ] })
2444
+ ] }),
2445
+ hasActive && /* @__PURE__ */ jsxs("div", { className: "prn-filter-chips", "aria-label": "Aktive Filter", children: [
2446
+ activeFilters.map((f) => /* @__PURE__ */ jsxs("span", { className: "prn-filter-chip", children: [
2447
+ f.label && /* @__PURE__ */ jsxs("span", { className: "prn-filter-chip-label", children: [
2448
+ f.label,
2449
+ ":"
2450
+ ] }),
2451
+ /* @__PURE__ */ jsx("span", { className: "prn-filter-chip-value", children: f.value }),
2452
+ onRemoveFilter && /* @__PURE__ */ jsx(
2453
+ Button$1,
2454
+ {
2455
+ className: "prn-filter-chip-remove",
2456
+ "aria-label": "Filter entfernen",
2457
+ onPress: () => onRemoveFilter(f.id),
2458
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xD7" })
2459
+ }
2460
+ )
2461
+ ] }, f.id)),
2462
+ onClearAll && /* @__PURE__ */ jsx(Button$1, { className: "prn-filter-clear", onPress: onClearAll, children: "Zur\xFCcksetzen" })
2463
+ ] })
2464
+ ] });
2465
+ }
2466
+ function ObjectPageSection(props) {
2467
+ const { id, titleText, children, hideTitleText, titleTextUppercase, wrapTitleText, titleTextLevel = "H3", header, className } = props;
2468
+ const level = levelToAria(titleTextLevel);
2469
+ return /* @__PURE__ */ jsxs(
2470
+ "section",
2471
+ {
2472
+ className: cx("prn-op-section", className),
2473
+ "data-section-id": id,
2474
+ role: "region",
2475
+ "aria-label": titleText,
2476
+ children: [
2477
+ !hideTitleText && /* @__PURE__ */ jsxs("div", { className: "prn-op-section-head", children: [
2478
+ /* @__PURE__ */ jsx(
2479
+ "div",
2480
+ {
2481
+ role: "heading",
2482
+ "aria-level": level,
2483
+ className: "prn-op-section-title",
2484
+ "data-uppercase": titleTextUppercase ? "" : void 0,
2485
+ "data-wrap": wrapTitleText ? "" : void 0,
2486
+ children: titleText
2487
+ }
2488
+ ),
2489
+ header && /* @__PURE__ */ jsx("div", { className: "prn-op-section-header-content", children: header })
2490
+ ] }),
2491
+ /* @__PURE__ */ jsx("div", { className: "prn-op-section-body", children })
2492
+ ]
2493
+ }
2494
+ );
2495
+ }
2496
+ function ObjectPageSubSection(props) {
2497
+ const { id, titleText, children, actions, hideTitleText, className } = props;
2498
+ return /* @__PURE__ */ jsxs("div", { className: cx("prn-op-subsection", className), "data-subsection-id": id, role: "group", "aria-label": titleText, children: [
2499
+ !hideTitleText && /* @__PURE__ */ jsxs("div", { className: "prn-op-subsection-head", children: [
2500
+ /* @__PURE__ */ jsx("div", { role: "heading", "aria-level": 4, className: "prn-op-subsection-title", children: titleText }),
2501
+ actions && /* @__PURE__ */ jsx("div", { className: "prn-op-subsection-actions", children: actions })
2502
+ ] }),
2503
+ /* @__PURE__ */ jsx("div", { className: "prn-op-subsection-body", children })
2504
+ ] });
2505
+ }
2506
+ function levelToAria(level) {
2507
+ return Number(level.slice(1));
2508
+ }
2509
+ var ObjectPage = forwardRef(function ObjectPage2(props, ref) {
2510
+ const {
2511
+ title,
2512
+ subtitle,
2513
+ status,
2514
+ kpis,
2515
+ actions,
2516
+ breadcrumbs,
2517
+ header,
2518
+ subHeader,
2519
+ snappedHeader,
2520
+ snappedSubHeader,
2521
+ expandedContent,
2522
+ snappedContent,
2523
+ actionsBar,
2524
+ navigationBar,
2525
+ headerArea,
2526
+ headerPinned,
2527
+ hidePinButton,
2528
+ preserveHeaderStateOnClick,
2529
+ onToggleHeaderArea,
2530
+ onPinButtonToggle,
2531
+ image,
2532
+ imageShapeCircle,
2533
+ footerArea,
2534
+ placeholder,
2535
+ mode = "default",
2536
+ selectedSectionId,
2537
+ selectedSubSectionId,
2538
+ onSelectedSectionChange,
2539
+ onBeforeNavigate,
2540
+ accessibilityAttributes,
2541
+ sections,
2542
+ children,
2543
+ glass,
2544
+ className,
2545
+ style
2546
+ } = props;
2547
+ const reactId = useId();
2548
+ const normalizedSections = useMemo(() => {
2549
+ const out = [];
2550
+ Children.forEach(children, (child) => {
2551
+ if (isValidElement(child) && child.type === ObjectPageSection) {
2552
+ const p = child.props;
2553
+ out.push({ id: p.id, titleText: p.titleText, node: child });
2554
+ }
2555
+ });
2556
+ if (sections && sections.length > 0) {
2557
+ sections.forEach((section, i) => {
2558
+ const id = `legacy-section-${i}`;
2559
+ const titleText = typeof section.title === "string" ? section.title : `Abschnitt ${i + 1}`;
2560
+ out.push({
2561
+ id,
2562
+ titleText,
2563
+ node: /* @__PURE__ */ jsx(ObjectPageSection, { id, titleText, hideTitleText: section.title == null, children: /* @__PURE__ */ jsx("dl", { className: "prn-field-grid", children: section.fields.map((field, j) => /* @__PURE__ */ jsxs("div", { className: "prn-field-row", children: [
2564
+ /* @__PURE__ */ jsx("dt", { className: "prn-field-key", children: field.label }),
2565
+ /* @__PURE__ */ jsx("dd", { className: "prn-field-val", "data-numeric": field.numeric ? "" : void 0, children: field.value })
2566
+ ] }, j)) }) }, id)
2567
+ });
2568
+ });
2569
+ }
2570
+ return out;
2571
+ }, [children, sections]);
2572
+ const freeChildren = useMemo(() => {
2573
+ const out = [];
2574
+ Children.forEach(children, (child) => {
2575
+ if (isValidElement(child) && child.type === ObjectPageSection) return;
2576
+ out.push(child);
2577
+ });
2578
+ return out;
2579
+ }, [children]);
2580
+ const hasAnchorBar = normalizedSections.length > 1;
2581
+ const [internalActiveId, setInternalActiveId] = useState(
2582
+ selectedSectionId ?? normalizedSections[0]?.id
2583
+ );
2584
+ const activeId = selectedSectionId ?? internalActiveId ?? normalizedSections[0]?.id;
2585
+ useEffect(() => {
2586
+ if (selectedSectionId != null) return;
2587
+ if (!normalizedSections.some((s) => s.id === internalActiveId)) {
2588
+ setInternalActiveId(normalizedSections[0]?.id);
2589
+ }
2590
+ }, [normalizedSections, internalActiveId, selectedSectionId]);
2591
+ const scrollRef = useRef(null);
2592
+ const sectionRefs = useRef(/* @__PURE__ */ new Map());
2593
+ const registerSection = useCallback((id, el) => {
2594
+ if (el) sectionRefs.current.set(id, el);
2595
+ else sectionRefs.current.delete(id);
2596
+ }, []);
2597
+ const navigateTo = useCallback(
2598
+ (id, opts = { scroll: true }) => {
2599
+ const index = normalizedSections.findIndex((s) => s.id === id);
2600
+ if (index < 0) return;
2601
+ let cancelled = false;
2602
+ onBeforeNavigate?.({
2603
+ sectionId: id,
2604
+ sectionIndex: index,
2605
+ preventDefault: () => {
2606
+ cancelled = true;
2607
+ }
2608
+ });
2609
+ if (cancelled) return;
2610
+ if (selectedSectionId == null) setInternalActiveId(id);
2611
+ onSelectedSectionChange?.({ selectedSectionIndex: index, selectedSectionId: id });
2612
+ if (opts.scroll && mode === "default") {
2613
+ const el = sectionRefs.current.get(id);
2614
+ el?.scrollIntoView({ behavior: "smooth", block: "start" });
2615
+ }
2616
+ },
2617
+ [normalizedSections, onBeforeNavigate, onSelectedSectionChange, selectedSectionId, mode]
2618
+ );
2619
+ useEffect(() => {
2620
+ if (mode !== "default" || !hasAnchorBar) return;
2621
+ if (typeof IntersectionObserver === "undefined") return;
2622
+ const observer = new IntersectionObserver(
2623
+ (entries) => {
2624
+ const visible = entries.filter((e) => e.isIntersecting).sort((a, b) => b.intersectionRatio - a.intersectionRatio);
2625
+ const top = visible[0];
2626
+ if (!top) return;
2627
+ const id = top.target.dataset.sectionAnchor;
2628
+ if (id && id !== activeId && selectedSectionId == null) {
2629
+ setInternalActiveId(id);
2630
+ const index = normalizedSections.findIndex((s) => s.id === id);
2631
+ onSelectedSectionChange?.({ selectedSectionIndex: index, selectedSectionId: id });
2632
+ }
2633
+ },
2634
+ { root: scrollRef.current, threshold: [0.1, 0.5, 0.9], rootMargin: "0px 0px -55% 0px" }
2635
+ );
2636
+ sectionRefs.current.forEach((el) => observer.observe(el));
2637
+ return () => observer.disconnect();
2638
+ }, [mode, hasAnchorBar, normalizedSections, selectedSectionId, onSelectedSectionChange]);
2639
+ const [snapped, setSnapped] = useState(false);
2640
+ const [pinned, setPinned] = useState(!!headerPinned);
2641
+ useEffect(() => {
2642
+ if (headerPinned != null) setPinned(headerPinned);
2643
+ }, [headerPinned]);
2644
+ const setSnappedState = useCallback(
2645
+ (next) => {
2646
+ setSnapped((prev) => {
2647
+ if (prev === next) return prev;
2648
+ onToggleHeaderArea?.(!next);
2649
+ return next;
2650
+ });
2651
+ },
2652
+ [onToggleHeaderArea]
2653
+ );
2654
+ useImperativeHandle(
2655
+ ref,
2656
+ () => ({
2657
+ toggleHeaderArea: (s) => {
2658
+ setSnappedState(s == null ? !snapped : s);
2659
+ }
2660
+ }),
2661
+ [setSnappedState, snapped]
2662
+ );
2663
+ const onScroll = useCallback(() => {
2664
+ if (pinned || !headerArea) return;
2665
+ const el = scrollRef.current;
2666
+ if (!el) return;
2667
+ setSnappedState(el.scrollTop > 8);
2668
+ }, [pinned, headerArea, setSnappedState]);
2669
+ const handleTitleClick = useCallback(() => {
2670
+ if (preserveHeaderStateOnClick || !headerArea) return;
2671
+ setSnappedState(!snapped);
2672
+ }, [preserveHeaderStateOnClick, headerArea, snapped, setSnappedState]);
2673
+ const togglePin = useCallback(() => {
2674
+ const next = !pinned;
2675
+ if (headerPinned == null) setPinned(next);
2676
+ onPinButtonToggle?.(next);
2677
+ if (next) setSnappedState(false);
2678
+ }, [pinned, headerPinned, onPinButtonToggle, setSnappedState]);
2679
+ const tabRefs = useRef(/* @__PURE__ */ new Map());
2680
+ const onTabKeyDown = useCallback(
2681
+ (e, index) => {
2682
+ let nextIndex = null;
2683
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") nextIndex = (index + 1) % normalizedSections.length;
2684
+ else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
2685
+ nextIndex = (index - 1 + normalizedSections.length) % normalizedSections.length;
2686
+ else if (e.key === "Home") nextIndex = 0;
2687
+ else if (e.key === "End") nextIndex = normalizedSections.length - 1;
2688
+ if (nextIndex == null) return;
2689
+ e.preventDefault();
2690
+ const target = normalizedSections[nextIndex];
2691
+ if (!target) return;
2692
+ navigateTo(target.id);
2693
+ tabRefs.current.get(target.id)?.focus();
2694
+ },
2695
+ [normalizedSections, navigateTo]
2696
+ );
2697
+ const effectiveActions = actions ?? actionsBar;
2698
+ const showSnappedTitle = snapped;
2699
+ const headerNode = showSnappedTitle && snappedHeader != null ? snappedHeader : header ?? title;
2700
+ const subHeaderNode = showSnappedTitle && snappedSubHeader != null ? snappedSubHeader : subHeader ?? subtitle;
2701
+ const renderImage = () => {
2702
+ if (image == null) return null;
2703
+ const inner = typeof image === "string" ? /* @__PURE__ */ jsx("img", { className: "prn-op-image-img", src: image, alt: "" }) : image;
2704
+ return /* @__PURE__ */ jsx("div", { className: "prn-op-image", "data-circle": imageShapeCircle ? "" : void 0, children: inner });
2705
+ };
2706
+ const topHeaderA11y = accessibilityAttributes?.objectPageTopHeader;
2707
+ const anchorBarA11y = accessibilityAttributes?.objectPageAnchorBar;
2708
+ const footerA11y = accessibilityAttributes?.objectPageFooterActions;
2709
+ return /* @__PURE__ */ jsxs(
2710
+ "div",
2711
+ {
2712
+ className: cx("prn-objectpage", className),
2713
+ "data-mode": mode,
2714
+ "data-snapped": snapped ? "" : void 0,
2715
+ "data-pinned": pinned ? "" : void 0,
2716
+ style,
2717
+ children: [
2718
+ /* @__PURE__ */ jsxs(
2719
+ "header",
2720
+ {
2721
+ className: cx(
2722
+ "prn-objectpage-head prn-op-top-header",
2723
+ glass && "prn-glass prn-glass-bar"
2724
+ ),
2725
+ role: topHeaderA11y?.role ?? "banner",
2726
+ "aria-label": topHeaderA11y?.["aria-label"],
2727
+ children: [
2728
+ breadcrumbs && /* @__PURE__ */ jsx("div", { className: "prn-op-breadcrumbs", children: breadcrumbs }),
2729
+ /* @__PURE__ */ jsxs("div", { className: "prn-objectpage-headrow", children: [
2730
+ renderImage(),
2731
+ /* @__PURE__ */ jsxs("div", { className: "prn-objectpage-titles", children: [
2732
+ /* @__PURE__ */ jsx(
2733
+ "h1",
2734
+ {
2735
+ className: "prn-objectpage-title",
2736
+ onClick: handleTitleClick,
2737
+ "data-clickable": !preserveHeaderStateOnClick && headerArea ? "" : void 0,
2738
+ children: headerNode
2739
+ }
2740
+ ),
2741
+ subHeaderNode && /* @__PURE__ */ jsx("span", { className: "prn-objectpage-subtitle", children: subHeaderNode }),
2742
+ (snapped ? snappedContent : expandedContent) && /* @__PURE__ */ jsx("div", { className: "prn-op-state-content", children: snapped ? snappedContent : expandedContent })
2743
+ ] }),
2744
+ status && /* @__PURE__ */ jsx("span", { className: "prn-objectpage-status", children: /* @__PURE__ */ jsxs("span", { className: "prn-status-badge", "data-tone": status.tone ?? "neutral", children: [
2745
+ /* @__PURE__ */ jsx("span", { className: "prn-status-dot", "aria-hidden": true }),
2746
+ status.label
2747
+ ] }) }),
2748
+ navigationBar && /* @__PURE__ */ jsx("div", { className: "prn-op-navigation-bar", children: navigationBar }),
2749
+ effectiveActions && /* @__PURE__ */ jsx("div", { className: "prn-objectpage-actions", children: effectiveActions }),
2750
+ !hidePinButton && headerArea && /* @__PURE__ */ jsx(
2751
+ "button",
2752
+ {
2753
+ type: "button",
2754
+ className: "prn-op-pin",
2755
+ "aria-pressed": pinned,
2756
+ "aria-label": pinned ? "Header l\xF6sen" : "Header anheften",
2757
+ onClick: togglePin,
2758
+ children: /* @__PURE__ */ jsx(Icon, { name: pinned ? "pin" : "pin-off", size: 16 })
2759
+ }
2760
+ )
2761
+ ] }),
2762
+ headerArea && !snapped && /* @__PURE__ */ jsx("div", { className: "prn-op-header-area", children: headerArea }),
2763
+ kpis && kpis.length > 0 && /* @__PURE__ */ jsx("div", { className: "prn-objectpage-kpis", children: kpis.map((kpi, i) => /* @__PURE__ */ jsxs("div", { className: "prn-kpi", children: [
2764
+ /* @__PURE__ */ jsx("span", { className: "prn-kpi-label", children: kpi.label }),
2765
+ /* @__PURE__ */ jsx("span", { className: "prn-kpi-value", "data-tone": kpi.tone, children: kpi.value })
2766
+ ] }, i)) })
2767
+ ]
2768
+ }
2769
+ ),
2770
+ hasAnchorBar && /* @__PURE__ */ jsx(
2771
+ "div",
2772
+ {
2773
+ className: "prn-op-anchorbar",
2774
+ role: anchorBarA11y?.role ?? "tablist",
2775
+ "aria-label": anchorBarA11y?.["aria-label"] ?? "Sektionen",
2776
+ children: normalizedSections.map((s, i) => {
2777
+ const selected = s.id === activeId;
2778
+ return /* @__PURE__ */ jsx(
2779
+ "button",
2780
+ {
2781
+ type: "button",
2782
+ role: "tab",
2783
+ id: `${reactId}-tab-${s.id}`,
2784
+ "aria-selected": selected,
2785
+ "aria-controls": `${reactId}-panel-${s.id}`,
2786
+ tabIndex: selected ? 0 : -1,
2787
+ className: "prn-op-anchor",
2788
+ "data-selected": selected ? "" : void 0,
2789
+ ref: (el) => {
2790
+ if (el) tabRefs.current.set(s.id, el);
2791
+ else tabRefs.current.delete(s.id);
2792
+ },
2793
+ onClick: () => navigateTo(s.id),
2794
+ onKeyDown: (e) => onTabKeyDown(e, i),
2795
+ children: s.titleText
2796
+ },
2797
+ s.id
2798
+ );
2799
+ })
2800
+ }
2801
+ ),
2802
+ placeholder != null ? /* @__PURE__ */ jsx("div", { className: "prn-op-placeholder", role: "status", children: placeholder }) : /* @__PURE__ */ jsx("div", { className: "prn-op-scroll", ref: scrollRef, onScroll, children: /* @__PURE__ */ jsxs("div", { className: "prn-objectpage-sections-stack", children: [
2803
+ normalizedSections.map((s) => {
2804
+ const isActive = s.id === activeId;
2805
+ if (mode === "iconTabBar" && !isActive) return null;
2806
+ return /* @__PURE__ */ jsx(
2807
+ "div",
2808
+ {
2809
+ className: "prn-op-section-anchor",
2810
+ "data-section-anchor": s.id,
2811
+ "data-active": isActive ? "" : void 0,
2812
+ id: `${reactId}-panel-${s.id}`,
2813
+ role: hasAnchorBar ? "tabpanel" : void 0,
2814
+ "aria-labelledby": hasAnchorBar ? `${reactId}-tab-${s.id}` : void 0,
2815
+ ref: (el) => registerSection(s.id, el),
2816
+ children: s.node
2817
+ },
2818
+ s.id
2819
+ );
2820
+ }),
2821
+ freeChildren
2822
+ ] }) }),
2823
+ footerArea && /* @__PURE__ */ jsx(
2824
+ "div",
2825
+ {
2826
+ className: "prn-op-footer",
2827
+ role: footerA11y?.role ?? "contentinfo",
2828
+ "aria-label": footerA11y?.["aria-label"],
2829
+ children: footerArea
2830
+ }
2831
+ ),
2832
+ selectedSubSectionId && /* @__PURE__ */ jsx("input", { type: "hidden", "data-selected-subsection": selectedSubSectionId, readOnly: true, value: "" })
2833
+ ]
2834
+ }
2835
+ );
2836
+ });
2837
+ var PREFIX = "apl:filterstate:";
2838
+ function readPersisted(persistKey, fallback) {
2839
+ if (typeof window === "undefined" || !window.localStorage) return fallback;
2840
+ try {
2841
+ const raw = localStorage.getItem(PREFIX + persistKey);
2842
+ if (!raw) return fallback;
2843
+ return { ...fallback, ...JSON.parse(raw) };
2844
+ } catch {
2845
+ return fallback;
2846
+ }
2847
+ }
2848
+ function writePersisted(persistKey, value) {
2849
+ if (typeof window === "undefined" || !window.localStorage) return;
2850
+ try {
2851
+ localStorage.setItem(PREFIX + persistKey, JSON.stringify(value));
2852
+ } catch {
2853
+ }
2854
+ }
2855
+ var defaultIsActive = (_k, value, dflt) => value !== dflt && value !== "" && value !== void 0 && value !== null;
2856
+ function useFilterState(options) {
2857
+ const { persistKey, defaultValues, labels, isActive = defaultIsActive } = options;
2858
+ const [values, setValuesState] = useState(() => readPersisted(persistKey, defaultValues));
2859
+ const persist = useCallback(
2860
+ (next) => {
2861
+ setValuesState(next);
2862
+ writePersisted(persistKey, next);
2863
+ },
2864
+ [persistKey]
2865
+ );
2866
+ const setValue = useCallback(
2867
+ (key, value) => persist({ ...values, [key]: value }),
2868
+ [persist, values]
2869
+ );
2870
+ const setValues = useCallback(
2871
+ (patch) => persist({ ...values, ...patch }),
2872
+ [persist, values]
2873
+ );
2874
+ const reset = useCallback(() => {
2875
+ if (typeof window !== "undefined" && window.localStorage) {
2876
+ try {
2877
+ localStorage.removeItem(PREFIX + persistKey);
2878
+ } catch {
2879
+ }
2880
+ }
2881
+ setValuesState(defaultValues);
2882
+ }, [persistKey, defaultValues]);
2883
+ const activeFilters = useMemo(() => {
2884
+ const out = [];
2885
+ for (const key of Object.keys(values)) {
2886
+ if (isActive(key, values[key], defaultValues[key])) {
2887
+ out.push({
2888
+ id: String(key),
2889
+ label: labels?.[key],
2890
+ value: String(values[key])
2891
+ });
2892
+ }
2893
+ }
2894
+ return out;
2895
+ }, [values, defaultValues, labels, isActive]);
2896
+ return { values, setValue, setValues, reset, activeFilters };
2897
+ }
2898
+ function RadioGroup({ label, description, errorMessage, children, className, ...props }) {
2899
+ return /* @__PURE__ */ jsxs(RadioGroup$1, { ...props, className: cx("prn-field prn-radiogroup", className), children: [
2900
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
2901
+ /* @__PURE__ */ jsx("div", { className: "prn-radiogroup-items", children }),
2902
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
2903
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
2904
+ ] });
2905
+ }
2906
+ function Radio({ children, className, ...props }) {
2907
+ return /* @__PURE__ */ jsxs(Radio$1, { ...props, className: cx("prn-radio", className), children: [
2908
+ /* @__PURE__ */ jsx("span", { className: "prn-radio-dot", "aria-hidden": true }),
2909
+ children && /* @__PURE__ */ jsx("span", { className: "prn-radio-label", children })
2910
+ ] });
2911
+ }
2912
+ function CheckboxGroup({ label, description, errorMessage, children, className, ...props }) {
2913
+ return /* @__PURE__ */ jsxs(CheckboxGroup$1, { ...props, className: cx("prn-field prn-checkboxgroup", className), children: [
2914
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
2915
+ /* @__PURE__ */ jsx("div", { className: "prn-checkboxgroup-items", children }),
2916
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
2917
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
2918
+ ] });
2919
+ }
2920
+ function NumberField({ label, description, errorMessage, placeholder, className, ...props }) {
2921
+ return /* @__PURE__ */ jsxs(NumberField$1, { ...props, className: cx("prn-field prn-numberfield", className), children: [
2922
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
2923
+ /* @__PURE__ */ jsxs(Group, { className: "prn-numberfield-group", children: [
2924
+ /* @__PURE__ */ jsx(Button$1, { slot: "decrement", className: "prn-numberfield-step", children: "\u2212" }),
2925
+ /* @__PURE__ */ jsx(Input, { className: "prn-input prn-numberfield-input", placeholder }),
2926
+ /* @__PURE__ */ jsx(Button$1, { slot: "increment", className: "prn-numberfield-step", children: "+" })
2927
+ ] }),
2928
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
2929
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
2930
+ ] });
2931
+ }
2932
+ function Slider({ label, showValue = true, className, ...props }) {
2933
+ return /* @__PURE__ */ jsxs(Slider$1, { ...props, className: cx("prn-slider", className), children: [
2934
+ /* @__PURE__ */ jsxs("div", { className: "prn-slider-header", children: [
2935
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
2936
+ showValue && /* @__PURE__ */ jsx(SliderOutput, { className: "prn-slider-output" })
2937
+ ] }),
2938
+ /* @__PURE__ */ jsx(SliderTrack, { className: "prn-slider-track", children: ({ state }) => /* @__PURE__ */ jsxs(Fragment, { children: [
2939
+ /* @__PURE__ */ jsx("div", { className: "prn-slider-fill", style: { width: `${state.getThumbPercent(0) * 100}%` } }),
2940
+ /* @__PURE__ */ jsx(SliderThumb, { className: "prn-slider-thumb" })
2941
+ ] }) })
2942
+ ] });
2943
+ }
2944
+ function ComboBox({ label, placeholder, description, errorMessage, children, className, ...props }) {
2945
+ return /* @__PURE__ */ jsxs(ComboBox$1, { ...props, className: cx("prn-field prn-combobox", className), children: [
2946
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
2947
+ /* @__PURE__ */ jsxs("div", { className: "prn-combobox-control", children: [
2948
+ /* @__PURE__ */ jsx(Input, { className: "prn-input prn-combobox-input", placeholder }),
2949
+ /* @__PURE__ */ jsx(Button$1, { className: "prn-combobox-button", children: /* @__PURE__ */ jsx(
2950
+ "svg",
2951
+ {
2952
+ viewBox: "0 0 12 12",
2953
+ width: "12",
2954
+ height: "12",
2955
+ "aria-hidden": true,
2956
+ fill: "none",
2957
+ stroke: "currentColor",
2958
+ strokeWidth: "1.6",
2959
+ strokeLinecap: "round",
2960
+ strokeLinejoin: "round",
2961
+ children: /* @__PURE__ */ jsx("path", { d: "M2.75 4.5 6 7.75 9.25 4.5" })
2962
+ }
2963
+ ) })
2964
+ ] }),
2965
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
2966
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage }),
2967
+ /* @__PURE__ */ jsx(Popover, { className: "prn-popover prn-combobox-popover", children: /* @__PURE__ */ jsx(ListBox, { className: "prn-listbox", children }) })
2968
+ ] });
2969
+ }
2970
+ function ComboBoxItem({ className, ...props }) {
2971
+ return /* @__PURE__ */ jsx(ListBoxItem, { ...props, className: cx("prn-option", className) });
2972
+ }
2973
+ function Form({ className, ...props }) {
2974
+ return /* @__PURE__ */ jsx(Form$1, { ...props, className: cx("prn-form", className) });
2975
+ }
2976
+ function FieldError5({ className, ...props }) {
2977
+ return /* @__PURE__ */ jsx(FieldError, { ...props, className: cx("prn-field-error", className) });
2978
+ }
2979
+ function ListBox3({ className, ...props }) {
2980
+ return /* @__PURE__ */ jsx(ListBox, { ...props, className: cx("prn-listbox prn-listbox-standalone", className) });
2981
+ }
2982
+ function ListBoxOption({ className, ...props }) {
2983
+ return /* @__PURE__ */ jsx(ListBoxItem, { ...props, className: cx("prn-option", className) });
2984
+ }
2985
+ function GridList({ className, ...props }) {
2986
+ return /* @__PURE__ */ jsx(GridList$1, { ...props, className: cx("prn-gridlist", className) });
2987
+ }
2988
+ function GridListItem({ className, children, ...props }) {
2989
+ return /* @__PURE__ */ jsx(GridListItem$1, { ...props, className: cx("prn-gridlist-item", className), children });
2990
+ }
2991
+ function TagGroup({
2992
+ label,
2993
+ children,
2994
+ renderEmptyState,
2995
+ items,
2996
+ className,
2997
+ ...props
2998
+ }) {
2999
+ return /* @__PURE__ */ jsxs(TagGroup$1, { ...props, className: cx("prn-taggroup", className), children: [
3000
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3001
+ /* @__PURE__ */ jsx(TagList, { className: "prn-taglist", items, renderEmptyState, children })
3002
+ ] });
3003
+ }
3004
+ function Tag({ children, className, textValue, ...props }) {
3005
+ const derivedTextValue = textValue ?? (typeof children === "string" ? children : void 0);
3006
+ return /* @__PURE__ */ jsx(Tag$1, { ...props, textValue: derivedTextValue, className: cx("prn-tag", className), children: ({ allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
3007
+ /* @__PURE__ */ jsx("span", { className: "prn-tag-label", children }),
3008
+ allowsRemoving && /* @__PURE__ */ jsx(Button$1, { slot: "remove", className: "prn-tag-remove", "aria-label": "Entfernen", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 14 14", "aria-hidden": true, className: "prn-tag-remove-icon", children: /* @__PURE__ */ jsx("path", { d: "M4 4 L10 10 M10 4 L4 10" }) }) })
3009
+ ] }) });
3010
+ }
3011
+ function Breadcrumbs({ className, ...props }) {
3012
+ return /* @__PURE__ */ jsx(Breadcrumbs$1, { ...props, className: cx("prn-breadcrumbs", className) });
3013
+ }
3014
+ function Breadcrumb({ className, ...props }) {
3015
+ return /* @__PURE__ */ jsx(Breadcrumb$1, { ...props, className: cx("prn-breadcrumb", className) });
3016
+ }
3017
+ function Link({ className, ...props }) {
3018
+ return /* @__PURE__ */ jsx(Link$1, { ...props, className: cx("prn-link", className) });
3019
+ }
3020
+ function Disclosure({ title, children, className, ...props }) {
3021
+ return /* @__PURE__ */ jsxs(Disclosure$1, { ...props, className: cx("prn-disclosure", className), children: [
3022
+ /* @__PURE__ */ jsx(Heading, { className: "prn-disclosure-heading", children: /* @__PURE__ */ jsxs(Button$1, { slot: "trigger", className: "prn-disclosure-trigger", children: [
3023
+ /* @__PURE__ */ jsx("span", { className: "prn-disclosure-title", children: title }),
3024
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "prn-disclosure-chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx("polyline", { points: "6,4 10,8 6,12" }) })
3025
+ ] }) }),
3026
+ /* @__PURE__ */ jsx(DisclosurePanel, { className: "prn-disclosure-panel", children })
3027
+ ] });
3028
+ }
3029
+ function DisclosureGroup({ className, ...props }) {
3030
+ return /* @__PURE__ */ jsx(DisclosureGroup$1, { ...props, className: cx("prn-disclosure-group", className) });
3031
+ }
3032
+ function Tree({ className, ...props }) {
3033
+ return /* @__PURE__ */ jsx(Tree$1, { ...props, className: cx("prn-tree", className) });
3034
+ }
3035
+ function TreeItem({ title, textValue, children, className, ...props }) {
3036
+ const resolvedTextValue = textValue ?? (typeof title === "string" ? title : "");
3037
+ return /* @__PURE__ */ jsxs(
3038
+ TreeItem$1,
3039
+ {
3040
+ ...props,
3041
+ textValue: resolvedTextValue,
3042
+ className: cx("prn-tree-item", className),
3043
+ children: [
3044
+ /* @__PURE__ */ jsx(TreeItemContent, { children: ({ hasChildItems, selectionMode }) => /* @__PURE__ */ jsxs("div", { className: "prn-tree-row", children: [
3045
+ selectionMode !== "none" && /* @__PURE__ */ jsx(Checkbox$1, { slot: "selection", className: "prn-tree-check", children: /* @__PURE__ */ jsx("span", { className: "prn-tree-check-box", "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 18 18", className: "prn-tree-check-mark", children: /* @__PURE__ */ jsx("polyline", { points: "4,9 8,13 14,5" }) }) }) }),
3046
+ hasChildItems ? /* @__PURE__ */ jsx(Button$1, { slot: "chevron", className: "prn-tree-chevron", "aria-label": "Aufklappen", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M6 4l4 4-4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) : /* @__PURE__ */ jsx("span", { className: "prn-tree-chevron prn-tree-chevron-spacer", "aria-hidden": true }),
3047
+ /* @__PURE__ */ jsx("span", { className: "prn-tree-label", children: title })
3048
+ ] }) }),
3049
+ children
3050
+ ]
3051
+ }
3052
+ );
3053
+ }
3054
+ function Table({ stickyHeader, className, ...props }) {
3055
+ return /* @__PURE__ */ jsx(
3056
+ Table$1,
3057
+ {
3058
+ ...props,
3059
+ "data-sticky": stickyHeader || void 0,
3060
+ className: cx("prn-table", className)
3061
+ }
3062
+ );
3063
+ }
3064
+ function TableHeader({ className, children, ...props }) {
3065
+ const { selectionBehavior, selectionMode } = useTableOptions();
3066
+ if (typeof children === "function") {
3067
+ return /* @__PURE__ */ jsx(TableHeader$1, { ...props, className: cx("prn-table-header", className), children });
3068
+ }
3069
+ return /* @__PURE__ */ jsxs(TableHeader$1, { ...props, className: cx("prn-table-header", className), children: [
3070
+ selectionBehavior === "toggle" && /* @__PURE__ */ jsx(Column$1, { className: "prn-table-column prn-table-selection-cell", children: selectionMode === "multiple" && /* @__PURE__ */ jsx(SelectionCheckbox, { slot: "selection" }) }),
3071
+ children
3072
+ ] });
3073
+ }
3074
+ function TableBody({ className, ...props }) {
3075
+ return /* @__PURE__ */ jsx(TableBody$1, { ...props, className: cx("prn-table-body", className) });
3076
+ }
3077
+ function Column({ children, className, ...props }) {
3078
+ return /* @__PURE__ */ jsx(Column$1, { ...props, className: cx("prn-table-column", className), children: (renderProps) => /* @__PURE__ */ jsxs("span", { className: "prn-table-column-inner", children: [
3079
+ children,
3080
+ renderProps.allowsSorting && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "prn-table-sort-indicator", "data-direction": renderProps.sortDirection, children: renderProps.sortDirection === "ascending" ? "\u25B2" : renderProps.sortDirection === "descending" ? "\u25BC" : "" })
3081
+ ] }) });
3082
+ }
3083
+ function Row({ className, children, columns, ...props }) {
3084
+ const { selectionBehavior } = useTableOptions();
3085
+ if (typeof children === "function") {
3086
+ return /* @__PURE__ */ jsx(Row$1, { ...props, columns, className: cx("prn-table-row", className), children });
3087
+ }
3088
+ return /* @__PURE__ */ jsxs(Row$1, { ...props, columns, className: cx("prn-table-row", className), children: [
3089
+ selectionBehavior === "toggle" && /* @__PURE__ */ jsx(Cell, { className: "prn-table-selection-cell", children: /* @__PURE__ */ jsx(SelectionCheckbox, { slot: "selection" }) }),
3090
+ children
3091
+ ] });
3092
+ }
3093
+ function Cell({ className, ...props }) {
3094
+ return /* @__PURE__ */ jsx(Cell$1, { ...props, className: cx("prn-table-cell", className) });
3095
+ }
3096
+ function SelectionCheckbox(props) {
3097
+ return /* @__PURE__ */ jsx(Checkbox$1, { ...props, className: "prn-checkbox prn-table-checkbox", children: /* @__PURE__ */ jsx("span", { className: "prn-checkbox-box", "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 18 18", className: "prn-checkbox-check", children: /* @__PURE__ */ jsx("polyline", { points: "4,9 8,13 14,5" }) }) }) });
3098
+ }
3099
+ function DateField({
3100
+ label,
3101
+ description,
3102
+ errorMessage,
3103
+ className,
3104
+ ...props
3105
+ }) {
3106
+ return /* @__PURE__ */ jsxs(DateField$1, { ...props, className: cx("prn-field", className), children: [
3107
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3108
+ /* @__PURE__ */ jsx(DateInput, { className: "prn-dateinput", children: (segment) => /* @__PURE__ */ jsx(DateSegment, { segment, className: "prn-datesegment" }) }),
3109
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
3110
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
3111
+ ] });
3112
+ }
3113
+ function TimeField({
3114
+ label,
3115
+ description,
3116
+ errorMessage,
3117
+ className,
3118
+ ...props
3119
+ }) {
3120
+ return /* @__PURE__ */ jsxs(TimeField$1, { ...props, className: cx("prn-field", className), children: [
3121
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3122
+ /* @__PURE__ */ jsx(DateInput, { className: "prn-dateinput", children: (segment) => /* @__PURE__ */ jsx(DateSegment, { segment, className: "prn-datesegment" }) }),
3123
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
3124
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
3125
+ ] });
3126
+ }
3127
+ function CalendarHeader() {
3128
+ return /* @__PURE__ */ jsxs("header", { className: "prn-calendar-header", children: [
3129
+ /* @__PURE__ */ jsx(Button$1, { slot: "previous", className: "prn-calendar-nav", "aria-label": "Vorheriger Monat", children: /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2039" }) }),
3130
+ /* @__PURE__ */ jsx(Heading, { className: "prn-calendar-title" }),
3131
+ /* @__PURE__ */ jsx(Button$1, { slot: "next", className: "prn-calendar-nav", "aria-label": "N\xE4chster Monat", children: /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u203A" }) })
3132
+ ] });
3133
+ }
3134
+ function CalendarMonthGrid() {
3135
+ return /* @__PURE__ */ jsxs(CalendarGrid, { className: "prn-calendar-grid", children: [
3136
+ /* @__PURE__ */ jsx(CalendarGridHeader, { className: "prn-calendar-grid-header", children: (day) => /* @__PURE__ */ jsx(CalendarHeaderCell, { className: "prn-calendar-weekday", children: day }) }),
3137
+ /* @__PURE__ */ jsx(CalendarGridBody, { className: "prn-calendar-grid-body", children: (date) => /* @__PURE__ */ jsx(CalendarCell, { date, className: "prn-calendar-cell" }) })
3138
+ ] });
3139
+ }
3140
+ function Calendar({ errorMessage, className, ...props }) {
3141
+ return /* @__PURE__ */ jsxs(Calendar$1, { ...props, className: cx("prn-calendar", className), children: [
3142
+ /* @__PURE__ */ jsx(CalendarHeader, {}),
3143
+ /* @__PURE__ */ jsx(CalendarMonthGrid, {}),
3144
+ errorMessage && /* @__PURE__ */ jsx(Text, { slot: "errorMessage", className: "prn-field-error", children: errorMessage })
3145
+ ] });
3146
+ }
3147
+ function RangeCalendar({ errorMessage, className, ...props }) {
3148
+ return /* @__PURE__ */ jsxs(RangeCalendar$1, { ...props, className: cx("prn-calendar prn-calendar-range", className), children: [
3149
+ /* @__PURE__ */ jsx(CalendarHeader, {}),
3150
+ /* @__PURE__ */ jsx(CalendarMonthGrid, {}),
3151
+ errorMessage && /* @__PURE__ */ jsx(Text, { slot: "errorMessage", className: "prn-field-error", children: errorMessage })
3152
+ ] });
3153
+ }
3154
+ function CalendarBody() {
3155
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3156
+ /* @__PURE__ */ jsxs("header", { className: "prn-cal-header", children: [
3157
+ /* @__PURE__ */ jsx(Button$1, { slot: "previous", className: "prn-cal-nav", "aria-label": "Vorheriger Monat", children: "\u2039" }),
3158
+ /* @__PURE__ */ jsx(Heading, { className: "prn-cal-heading" }),
3159
+ /* @__PURE__ */ jsx(Button$1, { slot: "next", className: "prn-cal-nav", "aria-label": "N\xE4chster Monat", children: "\u203A" })
3160
+ ] }),
3161
+ /* @__PURE__ */ jsxs(CalendarGrid, { className: "prn-cal-grid", children: [
3162
+ /* @__PURE__ */ jsx(CalendarGridHeader, { className: "prn-cal-grid-header", children: (day) => /* @__PURE__ */ jsx(CalendarHeaderCell, { className: "prn-cal-weekday", children: day }) }),
3163
+ /* @__PURE__ */ jsx(CalendarGridBody, { className: "prn-cal-grid-body", children: (date) => /* @__PURE__ */ jsx(CalendarCell, { date, className: "prn-cal-cell" }) })
3164
+ ] })
3165
+ ] });
3166
+ }
3167
+ function DatePicker({
3168
+ label,
3169
+ description,
3170
+ errorMessage,
3171
+ className,
3172
+ ...props
3173
+ }) {
3174
+ return /* @__PURE__ */ jsxs(DatePicker$1, { ...props, className: cx("prn-field prn-datepicker", className), children: [
3175
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3176
+ /* @__PURE__ */ jsxs(Group, { className: "prn-dateinput", children: [
3177
+ /* @__PURE__ */ jsx(DateInput, { className: "prn-dateinput-segments", children: (segment) => /* @__PURE__ */ jsx(DateSegment, { segment, className: "prn-date-segment" }) }),
3178
+ /* @__PURE__ */ jsx(Button$1, { className: "prn-dateinput-trigger", "aria-label": "Kalender \xF6ffnen", children: /* @__PURE__ */ jsxs(
3179
+ "svg",
3180
+ {
3181
+ viewBox: "0 0 16 16",
3182
+ width: "15",
3183
+ height: "15",
3184
+ "aria-hidden": true,
3185
+ fill: "none",
3186
+ stroke: "var(--prn-accent-strong)",
3187
+ strokeWidth: "1.4",
3188
+ strokeLinecap: "round",
3189
+ children: [
3190
+ /* @__PURE__ */ jsx("rect", { x: "2.25", y: "3.25", width: "11.5", height: "10.5", rx: "2.5" }),
3191
+ /* @__PURE__ */ jsx("path", { d: "M2.25 6.5h11.5M5 2v2.2M11 2v2.2" })
3192
+ ]
3193
+ }
3194
+ ) })
3195
+ ] }),
3196
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
3197
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage }),
3198
+ /* @__PURE__ */ jsx(Popover, { className: "prn-popover prn-cal-popover", children: /* @__PURE__ */ jsx(Dialog, { className: "prn-cal-dialog", children: /* @__PURE__ */ jsx(Calendar$1, { className: "prn-calendar", children: /* @__PURE__ */ jsx(CalendarBody, {}) }) }) })
3199
+ ] });
3200
+ }
3201
+ function DateRangePicker({
3202
+ label,
3203
+ description,
3204
+ errorMessage,
3205
+ className,
3206
+ ...props
3207
+ }) {
3208
+ return /* @__PURE__ */ jsxs(DateRangePicker$1, { ...props, className: cx("prn-field prn-daterangepicker", className), children: [
3209
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3210
+ /* @__PURE__ */ jsxs(Group, { className: "prn-dateinput prn-daterange-group", children: [
3211
+ /* @__PURE__ */ jsx(DateInput, { slot: "start", className: "prn-dateinput-segments", children: (segment) => /* @__PURE__ */ jsx(DateSegment, { segment, className: "prn-date-segment" }) }),
3212
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "prn-daterange-sep", children: "\u2013" }),
3213
+ /* @__PURE__ */ jsx(DateInput, { slot: "end", className: "prn-dateinput-segments", children: (segment) => /* @__PURE__ */ jsx(DateSegment, { segment, className: "prn-date-segment" }) }),
3214
+ /* @__PURE__ */ jsx(Button$1, { className: "prn-dateinput-trigger", "aria-label": "Kalender \xF6ffnen", children: /* @__PURE__ */ jsxs(
3215
+ "svg",
3216
+ {
3217
+ viewBox: "0 0 16 16",
3218
+ width: "15",
3219
+ height: "15",
3220
+ "aria-hidden": true,
3221
+ fill: "none",
3222
+ stroke: "var(--prn-accent-strong)",
3223
+ strokeWidth: "1.4",
3224
+ strokeLinecap: "round",
3225
+ children: [
3226
+ /* @__PURE__ */ jsx("rect", { x: "2.25", y: "3.25", width: "11.5", height: "10.5", rx: "2.5" }),
3227
+ /* @__PURE__ */ jsx("path", { d: "M2.25 6.5h11.5M5 2v2.2M11 2v2.2" })
3228
+ ]
3229
+ }
3230
+ ) })
3231
+ ] }),
3232
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
3233
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage }),
3234
+ /* @__PURE__ */ jsx(Popover, { className: "prn-popover prn-cal-popover", children: /* @__PURE__ */ jsx(Dialog, { className: "prn-cal-dialog", children: /* @__PURE__ */ jsx(RangeCalendar$1, { className: "prn-calendar", children: /* @__PURE__ */ jsx(CalendarBody, {}) }) }) })
3235
+ ] });
3236
+ }
3237
+ function ColorField({
3238
+ label,
3239
+ description,
3240
+ errorMessage,
3241
+ placeholder,
3242
+ className,
3243
+ ...props
3244
+ }) {
3245
+ return /* @__PURE__ */ jsxs(ColorField$1, { ...props, className: cx("prn-field", className), children: [
3246
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3247
+ /* @__PURE__ */ jsx(Input, { className: "prn-input prn-colorfield-input", placeholder }),
3248
+ description && /* @__PURE__ */ jsx(Text, { slot: "description", className: "prn-field-desc", children: description }),
3249
+ /* @__PURE__ */ jsx(FieldError, { className: "prn-field-error", children: errorMessage })
3250
+ ] });
3251
+ }
3252
+ function ColorSwatch({ className, ...props }) {
3253
+ return /* @__PURE__ */ jsx(ColorSwatch$1, { ...props, className: cx("prn-colorswatch", className) });
3254
+ }
3255
+ function ColorSwatchPicker({
3256
+ className,
3257
+ children,
3258
+ ...props
3259
+ }) {
3260
+ return /* @__PURE__ */ jsx(ColorSwatchPicker$1, { ...props, className: cx("prn-colorswatch-picker", className), children });
3261
+ }
3262
+ function ColorSwatchPickerItem({
3263
+ className,
3264
+ ...props
3265
+ }) {
3266
+ return /* @__PURE__ */ jsx(
3267
+ ColorSwatchPickerItem$1,
3268
+ {
3269
+ ...props,
3270
+ className: cx("prn-colorswatch-picker-item", className),
3271
+ children: /* @__PURE__ */ jsx(ColorSwatch, {})
3272
+ }
3273
+ );
3274
+ }
3275
+ function ColorArea({ className, ...props }) {
3276
+ return /* @__PURE__ */ jsx(ColorArea$1, { ...props, className: cx("prn-colorarea", className), children: /* @__PURE__ */ jsx(ColorThumb, { className: "prn-color-thumb" }) });
3277
+ }
3278
+ function ColorSlider({ label, showValue = true, className, ...props }) {
3279
+ return /* @__PURE__ */ jsxs(ColorSlider$1, { ...props, className: cx("prn-colorslider", className), children: [
3280
+ (label || showValue) && /* @__PURE__ */ jsxs("div", { className: "prn-colorslider-head", children: [
3281
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3282
+ showValue && /* @__PURE__ */ jsx(SliderOutput, { className: "prn-colorslider-output" })
3283
+ ] }),
3284
+ /* @__PURE__ */ jsx(SliderTrack, { className: "prn-colorslider-track", children: /* @__PURE__ */ jsx(ColorThumb, { className: "prn-color-thumb" }) })
3285
+ ] });
3286
+ }
3287
+ function ColorWheel({ className, outerRadius = 100, innerRadius = 74, ...props }) {
3288
+ return /* @__PURE__ */ jsxs(
3289
+ ColorWheel$1,
3290
+ {
3291
+ ...props,
3292
+ outerRadius,
3293
+ innerRadius,
3294
+ className: cx("prn-colorwheel", className),
3295
+ children: [
3296
+ /* @__PURE__ */ jsx(ColorWheelTrack, { className: "prn-colorwheel-track" }),
3297
+ /* @__PURE__ */ jsx(ColorThumb, { className: "prn-color-thumb" })
3298
+ ]
3299
+ }
3300
+ );
3301
+ }
3302
+ function ColorPicker({ label = "Farbe", children, className, ...props }) {
3303
+ return /* @__PURE__ */ jsx(ColorPicker$1, { ...props, children: /* @__PURE__ */ jsxs(DialogTrigger, { children: [
3304
+ /* @__PURE__ */ jsxs(Button$1, { className: cx("prn-colorpicker-trigger", className), children: [
3305
+ /* @__PURE__ */ jsx(ColorSwatch$1, { className: "prn-colorpicker-swatch" }),
3306
+ label && /* @__PURE__ */ jsx("span", { className: "prn-colorpicker-label", children: label }),
3307
+ /* @__PURE__ */ jsx("span", { className: "prn-select-chevron", "aria-hidden": true, children: "\u2304" })
3308
+ ] }),
3309
+ /* @__PURE__ */ jsx(Popover, { className: "prn-popover prn-colorpicker-popover", placement: "bottom start", children: /* @__PURE__ */ jsx(Dialog, { className: "prn-colorpicker-dialog", "aria-label": "Farbe w\xE4hlen", children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
3310
+ /* @__PURE__ */ jsx(
3311
+ ColorArea,
3312
+ {
3313
+ colorSpace: "hsb",
3314
+ xChannel: "saturation",
3315
+ yChannel: "brightness",
3316
+ className: "prn-colorpicker-area"
3317
+ }
3318
+ ),
3319
+ /* @__PURE__ */ jsx(ColorSlider, { colorSpace: "hsb", channel: "hue" }),
3320
+ /* @__PURE__ */ jsx(ColorField, { label: "Hex" })
3321
+ ] }) }) })
3322
+ ] }) });
3323
+ }
3324
+ function ProgressBar({ label, showValue = true, className, ...props }) {
3325
+ return /* @__PURE__ */ jsx(ProgressBar$1, { ...props, className: cx("prn-progressbar", className), children: ({ percentage, valueText, isIndeterminate }) => /* @__PURE__ */ jsxs(Fragment, { children: [
3326
+ (label || showValue) && /* @__PURE__ */ jsxs("div", { className: "prn-progressbar-head", children: [
3327
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3328
+ showValue && !isIndeterminate && /* @__PURE__ */ jsx("span", { className: "prn-progressbar-value", children: valueText })
3329
+ ] }),
3330
+ /* @__PURE__ */ jsx("div", { className: "prn-progressbar-track", children: /* @__PURE__ */ jsx(
3331
+ "div",
3332
+ {
3333
+ className: "prn-progressbar-fill",
3334
+ "data-indeterminate": isIndeterminate || void 0,
3335
+ style: isIndeterminate ? void 0 : { width: `${percentage ?? 0}%` }
3336
+ }
3337
+ ) })
3338
+ ] }) });
3339
+ }
3340
+ function bandFor(percentage) {
3341
+ if (percentage >= 85) return "high";
3342
+ if (percentage >= 60) return "medium";
3343
+ return "low";
3344
+ }
3345
+ function Meter({ label, showValue = true, bands = false, className, ...props }) {
3346
+ return /* @__PURE__ */ jsx(Meter$1, { ...props, className: cx("prn-meter", className), children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs(Fragment, { children: [
3347
+ (label || showValue) && /* @__PURE__ */ jsxs("div", { className: "prn-meter-head", children: [
3348
+ label && /* @__PURE__ */ jsx(Label, { className: "prn-field-label", children: label }),
3349
+ showValue && /* @__PURE__ */ jsx("span", { className: "prn-meter-value", children: valueText })
3350
+ ] }),
3351
+ /* @__PURE__ */ jsx("div", { className: "prn-meter-track", children: /* @__PURE__ */ jsx(
3352
+ "div",
3353
+ {
3354
+ className: "prn-meter-fill",
3355
+ "data-band": bands ? bandFor(percentage) : void 0,
3356
+ style: { width: `${percentage}%` }
3357
+ }
3358
+ ) })
3359
+ ] }) });
3360
+ }
3361
+ function Separator({ className, ...props }) {
3362
+ return /* @__PURE__ */ jsx(Separator$1, { ...props, className: cx("prn-separator", className) });
3363
+ }
3364
+ function Group3({ className, ...props }) {
3365
+ return /* @__PURE__ */ jsx(Group, { ...props, className: cx("prn-group", className) });
3366
+ }
3367
+ var toastQueue = new UNSTABLE_ToastQueue({
3368
+ maxVisibleToasts: 5
3369
+ });
3370
+ function ToastRegion({ queue = toastQueue, className, ...props }) {
3371
+ return /* @__PURE__ */ jsx(
3372
+ UNSTABLE_ToastRegion,
3373
+ {
3374
+ ...props,
3375
+ queue,
3376
+ className: cx("prn-toast-region", className),
3377
+ children: ({ toast }) => /* @__PURE__ */ jsxs(
3378
+ UNSTABLE_Toast,
3379
+ {
3380
+ toast,
3381
+ className: "prn-toast",
3382
+ "data-variant": toast.content.variant ?? "default",
3383
+ children: [
3384
+ /* @__PURE__ */ jsxs(UNSTABLE_ToastContent, { className: "prn-toast-content", children: [
3385
+ /* @__PURE__ */ jsx("span", { className: "prn-toast-title", children: toast.content.title }),
3386
+ toast.content.description && /* @__PURE__ */ jsx("span", { className: "prn-toast-desc", children: toast.content.description })
3387
+ ] }),
3388
+ /* @__PURE__ */ jsx(Button$1, { slot: "close", className: "prn-toast-close", "aria-label": "Schlie\xDFen", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 14 14", "aria-hidden": true, className: "prn-toast-close-icon", children: /* @__PURE__ */ jsx("path", { d: "M3 3 L11 11 M11 3 L3 11" }) }) })
3389
+ ]
3390
+ }
3391
+ )
3392
+ }
3393
+ );
3394
+ }
3395
+ function DropZone({ children, className, ...props }) {
3396
+ return /* @__PURE__ */ jsx(DropZone$1, { ...props, className: cx("prn-dropzone", className), children });
3397
+ }
3398
+ function FileTrigger({ children = "Datei w\xE4hlen", className, ...props }) {
3399
+ return /* @__PURE__ */ jsx(FileTrigger$1, { ...props, children: /* @__PURE__ */ jsx(Button$1, { className: cx("prn-button", className), "data-variant": "tinted", children }) });
3400
+ }
3401
+ function GlassSurface({
3402
+ variant = "card",
3403
+ tintColor,
3404
+ as,
3405
+ className,
3406
+ style,
3407
+ children,
3408
+ ...rest
3409
+ }) {
3410
+ const Component = as ?? "div";
3411
+ const mergedStyle = tintColor ? { "--prn-glass-tint": tintColor, ...style } : style;
3412
+ return /* @__PURE__ */ jsx(
3413
+ Component,
3414
+ {
3415
+ className: cx("prn-glass", `prn-glass-${variant}`, className),
3416
+ style: mergedStyle,
3417
+ ...rest,
3418
+ children
3419
+ }
3420
+ );
3421
+ }
3422
+
3423
+ // src/index.ts
3424
+ var PRINCE_UI_VERSION = "0.8.0";
3425
+ function setTheme(theme) {
3426
+ const root = document.documentElement;
3427
+ if (theme === null) {
3428
+ root.removeAttribute("data-theme");
3429
+ } else {
3430
+ root.setAttribute("data-theme", theme);
3431
+ }
3432
+ }
3433
+ function getTheme() {
3434
+ return document.documentElement.getAttribute("data-theme") ?? null;
3435
+ }
3436
+
3437
+ export { Amount, AnalyticalTable, AppShell, AreaChart, Badge, BarChart, Breadcrumb, Breadcrumbs, Button, Calendar, Card, Cell, ChartEmpty, Checkbox, CheckboxGroup, ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker, ColorSwatchPickerItem, ColorWheel, Column, ComboBox, ComboBoxItem, DateField, DatePicker, DateRangePicker, DescriptionList, Disclosure, DisclosureGroup, DonutChart, DropZone, EmptyState, Field, FieldError5 as FieldError, FileTrigger, FilterBar, FilterField, Form, GlassSurface, GridList, GridListItem, Group3 as Group, Icon, KpiCard, Launchpad, Link, List, ListBox3 as ListBox, ListBoxOption, ListRow, Menu, MenuItem, Meter, Modal, Notice, NumberField, ObjectPage, ObjectPageSection, ObjectPageSubSection, PRINCE_UI_VERSION, Popover2 as Popover, ProgressBar, Radio, RadioGroup, RangeCalendar, Row, SearchField, Segment, SegmentedControl, Select, SelectItem, Separator, Sidebar, Slider, Sparkline, Switch, Tab, TabBar, TabPanel, Table, TableBody, TableHeader, Tabs, Tag, TagGroup, TextField, TimeField, ToastRegion, Toolbar, Tooltip, Tree, TreeItem, cx, getTheme, setTheme, smoothPath, toastQueue, useFilterState };
3438
+ //# sourceMappingURL=index.js.map
3439
+ //# sourceMappingURL=index.js.map