@public-ui/sample-react 5.0.0-beta.1 → 5.0.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/sample-react",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "This app contains samples for the KoliBri/Public UI",
5
5
  "type": "module",
6
6
  "license": "EUPL-1.2",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@hookform/resolvers": "5.9.2",
13
- "@stencil/core": "4.45.2",
13
+ "@stencil/core": "4.45.3",
14
14
  "@types/node": "26.4.0",
15
15
  "@types/papaparse": "5.5.2",
16
16
  "papaparse": "5.7.0",
@@ -20,13 +20,13 @@
20
20
  "typescript": "5.9.3",
21
21
  "world_countries_lists": "3.3.0",
22
22
  "zod": "4.6.7",
23
- "@public-ui/react-hook-form-adapter": "5.0.0-beta.1",
24
- "@public-ui/react-v19": "5.0.0-beta.1"
23
+ "@public-ui/react-hook-form-adapter": "5.0.0-beta.3",
24
+ "@public-ui/react-v19": "5.0.0-beta.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "19.2.18",
28
28
  "@types/react-dom": "19.2.5",
29
- "adopted-style-sheets": "1.1.9-rc.25",
29
+ "adopted-style-sheets": "1.2.0-rc.3",
30
30
  "eslint": "9.39.5",
31
31
  "knip": "6.42.1",
32
32
  "prettier": "3.9.10",
@@ -37,7 +37,7 @@
37
37
  "react": "19.2.8",
38
38
  "react-dom": "19.2.8",
39
39
  "react-router": "8.4.0",
40
- "@public-ui/components": "5.0.0-beta.1"
40
+ "@public-ui/components": "5.0.0-beta.3"
41
41
  },
42
42
  "files": [
43
43
  "assets",
@@ -58,7 +58,7 @@ export const DrawerScrolled: FC = () => {
58
58
  gap: '20px',
59
59
  }}
60
60
  >
61
- <p>✅ Content with proper overflow handling - scrollable within drawer bounds</p>
61
+ <p>Content with proper overflow handling - scrollable within drawer bounds</p>
62
62
  <div>
63
63
  <h3>Large Content Area (Scrollable)</h3>
64
64
  <p>
@@ -0,0 +1,16 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+
4
+ import { FormWrap } from '../FormWrap';
5
+ import { SampleDescription } from '../SampleDescription';
6
+ import { InputFileVariantsDragnDrop } from './partials/variants';
7
+
8
+ export const InputFileDragnDrop: FC = () => (
9
+ <>
10
+ <SampleDescription>
11
+ <p>KolInputFile renders a file input field. The sample shows KolInputFile in a form context with all variations and states.</p>
12
+ </SampleDescription>
13
+
14
+ <FormWrap RefComponent={InputFileVariantsDragnDrop} showButtons={false} />
15
+ </>
16
+ );
@@ -84,3 +84,23 @@ export const InputFileCases = forwardRef<HTMLKolInputFileElement, InputFileCases
84
84
  </div>
85
85
  );
86
86
  });
87
+
88
+ export const InputFileCasesDragnDrop = forwardRef<HTMLKolInputFileElement, InputFileCasesProps>(function InputFileCases({ blockIdPrefix, ...props }) {
89
+ const block = (caseId: string) => ({ id: `${blockIdPrefix}-${caseId}` });
90
+ return (
91
+ <div className="grid gap-4">
92
+ <SampleBlock {...block('accept')}>
93
+ <KolInputFile {...props} _label="Accept" _touched />
94
+ </SampleBlock>
95
+ <SampleBlock {...block('accept-multiple')}>
96
+ <KolInputFile {...props} _label="Accept multiple" _multiple _touched />
97
+ </SampleBlock>
98
+ <SampleBlock {...block('accept-disabled')}>
99
+ <KolInputFile {...props} _label="Accept disabled" _disabled _touched />
100
+ </SampleBlock>
101
+ <SampleBlock {...block('accept-multiple-disabled')}>
102
+ <KolInputFile {...props} _label="Accept multiple disabled" _multiple _disabled _touched />
103
+ </SampleBlock>
104
+ </div>
105
+ );
106
+ });
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
2
2
 
3
3
  import { SampleColumns } from '../../SampleColumns';
4
4
  import { SampleGroup } from '../../SampleGroup';
5
- import { InputFileCases } from './cases';
5
+ import { InputFileCases, InputFileCasesDragnDrop } from './cases';
6
6
 
7
7
  import type { Components } from '@public-ui/components';
8
8
  export const InputFileVariants = forwardRef<HTMLKolInputFileElement, Components.KolInputFile>(function InputFileVariant(props, ref) {
@@ -17,3 +17,16 @@ export const InputFileVariants = forwardRef<HTMLKolInputFileElement, Components.
17
17
  </SampleColumns>
18
18
  );
19
19
  });
20
+
21
+ export const InputFileVariantsDragnDrop = forwardRef<HTMLKolInputFileElement, Components.KolInputFile>(function InputFileVariant(props) {
22
+ return (
23
+ <SampleColumns>
24
+ <SampleGroup heading="File">
25
+ <InputFileCasesDragnDrop blockIdPrefix="label" {...props} _accept=".pdf" />
26
+ </SampleGroup>
27
+ <SampleGroup heading="File (hideLabel)">
28
+ <InputFileCasesDragnDrop blockIdPrefix="hide-label" {...props} _accept=".pdf" _hideLabel />
29
+ </SampleGroup>
30
+ </SampleColumns>
31
+ );
32
+ });
@@ -1,10 +1,12 @@
1
1
  import type { Routes } from '../../shares/types';
2
2
  import { InputFileBasic } from './basic';
3
+ import { InputFileDragnDrop } from './drag-and-drop';
3
4
  import { InputFileOnInputOnChange } from './get-value';
4
5
 
5
6
  export const INPUT_FILE_ROUTES: Routes = {
6
7
  'input-file': {
7
8
  basic: InputFileBasic,
9
+ 'drag-and-drop': InputFileDragnDrop,
8
10
  'get-value': InputFileOnInputOnChange,
9
11
  },
10
12
  };
@@ -0,0 +1,50 @@
1
+ import React, { useEffect, useState } from 'react';
2
+
3
+ import { KolButton, KolProgress } from '@public-ui/react-v19';
4
+
5
+ import type { FC } from 'react';
6
+ import { SampleBlock } from '../SampleBlock';
7
+ import { SampleDescription } from '../SampleDescription';
8
+
9
+ const MAX = 100;
10
+ const STEP = 5;
11
+ const TICK_MS = 1000;
12
+
13
+ export const ProgressDynamic: FC = () => {
14
+ const [value, setValue] = useState<number>(0);
15
+ const [running, setRunning] = useState<boolean>(true);
16
+ const [mounted, setMounted] = useState<boolean>(true);
17
+
18
+ useEffect(() => {
19
+ if (!running) {
20
+ return;
21
+ }
22
+ const timer = setInterval(() => setValue((current) => (current >= MAX ? 0 : current + STEP)), TICK_MS);
23
+ return () => clearInterval(timer);
24
+ }, [running]);
25
+
26
+ return (
27
+ <>
28
+ <SampleDescription>
29
+ <p>
30
+ The value grows by {STEP} every second and starts again at 0 after {MAX}. Screen readers announce the current value every 5 seconds through the live
31
+ region. Removing and inserting the components again checks that the announcement continues afterwards.
32
+ </p>
33
+ </SampleDescription>
34
+
35
+ <SampleBlock id="progress-dynamic" skipSnapshot>
36
+ <div className="flex gap-4">
37
+ <KolButton _label={running ? 'Pause' : 'Resume'} _on={{ onClick: () => setRunning(!running) }} />
38
+ <KolButton _label={mounted ? 'Remove' : 'Insert'} _on={{ onClick: () => setMounted(!mounted) }} />
39
+ </div>
40
+
41
+ {mounted && (
42
+ <>
43
+ <KolProgress _label="Upload" _variant="bar" _max={MAX} _value={value} />
44
+ <KolProgress _label="Upload" _variant="cycle" _max={MAX} _value={value} />
45
+ </>
46
+ )}
47
+ </SampleBlock>
48
+ </>
49
+ );
50
+ };
@@ -1,10 +1,12 @@
1
1
  import type { Routes } from '../../shares/types';
2
2
  import { ProgressBasic } from './basic';
3
3
  import { ProgressChanging } from './changing';
4
+ import { ProgressDynamic } from './dynamic';
4
5
 
5
6
  export const PROGRESS_ROUTES: Routes = {
6
7
  progress: {
7
8
  basic: ProgressBasic,
8
9
  changing: ProgressChanging,
10
+ dynamic: ProgressDynamic,
9
11
  },
10
12
  };
@@ -57,6 +57,7 @@ export const TableStatelessAsync: FC = () => {
57
57
  }}
58
58
  />
59
59
  <KolPagination
60
+ _label="Pagination for the demonstration table"
60
61
  _max={200}
61
62
  _page={1}
62
63
  _siblingCount={0}
@@ -44,10 +44,10 @@ export const TabsAlign: FC = () => (
44
44
  <div key={align} className="grid gap-4">
45
45
  <KolHeading _level={2} _label={text} />
46
46
  <KolTabs _tabs={tabs} _align={align} _label={text}>
47
- <div slot="tab-0">Contents of Tab 1</div>
48
- <div slot="tab-1">Contents of Tab 2</div>
49
- <div slot="tab-2">Contents of Tab 3</div>
50
- <div slot="tab-3">Contents of Tab 4</div>
47
+ <p slot="tab-0">Contents of Tab 1</p>
48
+ <p slot="tab-1">Contents of Tab 2</p>
49
+ <p slot="tab-2">Contents of Tab 3</p>
50
+ <p slot="tab-3">Contents of Tab 4</p>
51
51
  </KolTabs>
52
52
  </div>
53
53
  );
@@ -43,19 +43,19 @@ export const TabsBasic: FC = () => (
43
43
 
44
44
  <SampleBlock id="regular">
45
45
  <KolTabs _tabs={tabsWithoutIcons} _label="Regular tabs">
46
- <div slot="tab-0">Contents of Tab 1</div>
47
- <div slot="tab-1">Contents of Tab 2</div>
48
- <div slot="tab-2">Contents of Tab 3</div>
49
- <div slot="tab-3">Contents of Tab 4</div>
46
+ <p slot="tab-0">Contents of Tab 1</p>
47
+ <p slot="tab-1">Contents of Tab 2</p>
48
+ <p slot="tab-2">Contents of Tab 3</p>
49
+ <p slot="tab-3">Contents of Tab 4</p>
50
50
  </KolTabs>
51
51
  </SampleBlock>
52
52
 
53
53
  <SampleBlock id="icons">
54
54
  <KolTabs _tabs={tabs} className="mt-4" _label="Tabs with icons">
55
- <div slot="tab-0">Contents of Tab 1</div>
56
- <div slot="tab-1">Contents of Tab 2</div>
57
- <div slot="tab-2">Contents of Tab 3</div>
58
- <div slot="tab-3">Contents of Tab 4</div>
55
+ <p slot="tab-0">Contents of Tab 1</p>
56
+ <p slot="tab-1">Contents of Tab 2</p>
57
+ <p slot="tab-2">Contents of Tab 3</p>
58
+ <p slot="tab-3">Contents of Tab 4</p>
59
59
  </KolTabs>
60
60
  </SampleBlock>
61
61
  </>
@@ -41,19 +41,19 @@ export const TabsBehavior: FC = () => (
41
41
  <div className="grid gap-4">
42
42
  <KolHeading _level={2} _label='Tabs with "select manual" behavior' />
43
43
  <KolTabs _tabs={tabs} _behavior="select-manual" _label="Tabs with select manual behavior">
44
- <div slot="tab-0">Contents of Tab 1</div>
45
- <div slot="tab-1">Contents of Tab 2</div>
46
- <div slot="tab-2">Contents of Tab 3</div>
47
- <div slot="tab-3">Contents of Tab 4</div>
44
+ <p slot="tab-0">Contents of Tab 1</p>
45
+ <p slot="tab-1">Contents of Tab 2</p>
46
+ <p slot="tab-2">Contents of Tab 3</p>
47
+ <p slot="tab-3">Contents of Tab 4</p>
48
48
  </KolTabs>
49
49
  </div>
50
50
  <div className="grid gap-4">
51
51
  <KolHeading _level={2} _label='Tabs with "select automatic" behavior' />
52
52
  <KolTabs _tabs={tabs} className="mt-4" _behavior="select-automatic" _label="Tabs with select automatic behavior">
53
- <div slot="tab-0">Contents of Tab 1</div>
54
- <div slot="tab-1">Contents of Tab 2</div>
55
- <div slot="tab-2">Contents of Tab 3</div>
56
- <div slot="tab-3">Contents of Tab 4</div>
53
+ <p slot="tab-0">Contents of Tab 1</p>
54
+ <p slot="tab-1">Contents of Tab 2</p>
55
+ <p slot="tab-2">Contents of Tab 3</p>
56
+ <p slot="tab-3">Contents of Tab 4</p>
57
57
  </KolTabs>
58
58
  </div>
59
59
  </div>
@@ -32,12 +32,12 @@ export const CreateButton: FC = () => {
32
32
  <SampleBlock id="create-button">
33
33
  <KolTabs _tabs={tabs} className="mt-4" _label="Tabs with create button" _hasCreateButton _on={{ onCreate: addTab }}>
34
34
  {tabs.map((tab, index) => (
35
- <div key={`tab-${index}`} slot={`tab-${index}`}>
35
+ <p key={`tab-${index}`} slot={`tab-${index}`}>
36
36
  Contents of {tab._label}
37
- </div>
37
+ </p>
38
38
  ))}
39
39
 
40
- <div slot="tab-1">Contents of Tab 2</div>
40
+ <p slot="tab-1">Contents of Tab 2</p>
41
41
  </KolTabs>
42
42
  </SampleBlock>
43
43
  </>
@@ -41,10 +41,10 @@ export const TabsIconsOnly: FC = () => (
41
41
 
42
42
  <SampleBlock id="icons-only">
43
43
  <KolTabs _label="Tabs with icons" _tabs={tabs}>
44
- <div slot="tab-0">Contents of Tab 1</div>
45
- <div slot="tab-1">Contents of Tab 2</div>
46
- <div slot="tab-2">Contents of Tab 3</div>
47
- <div slot="tab-3">Contents of Tab 4</div>
44
+ <p slot="tab-0">Contents of Tab 1</p>
45
+ <p slot="tab-1">Contents of Tab 2</p>
46
+ <p slot="tab-2">Contents of Tab 3</p>
47
+ <p slot="tab-3">Contents of Tab 4</p>
48
48
  </KolTabs>
49
49
  </SampleBlock>
50
50
  </>
@@ -1,9 +1,9 @@
1
- import { KolButton, KolInputCheckbox, KolInputNumber, KolInputText, KolSkeleton } from '@public-ui/react-v19';
1
+ import { KolButton, KolInputCheckbox, KolInputNumber, KolInputText } from '@public-ui/react-v19';
2
2
  import type { FC } from 'react';
3
3
  import React, { useState } from 'react';
4
4
  import { SampleDescription } from '../components/SampleDescription';
5
5
 
6
- type ComponentType = 'text' | 'number' | 'checkbox' | 'skeleton';
6
+ type ComponentType = 'text' | 'number' | 'checkbox';
7
7
 
8
8
  export const PerformanceTest: FC = () => {
9
9
  const [count, setCount] = useState<number>(100);
@@ -25,8 +25,6 @@ export const PerformanceTest: FC = () => {
25
25
  return <KolInputNumber key={idx} _label={`NumberInput #${idx}`} />;
26
26
  case 'checkbox':
27
27
  return <KolInputCheckbox key={idx} _label={`Checkbox #${idx}`} />;
28
- case 'skeleton':
29
- return <KolSkeleton key={idx} _name={`skeleton-${idx}`} />;
30
28
  default:
31
29
  return null;
32
30
  }
@@ -78,7 +76,6 @@ export const PerformanceTest: FC = () => {
78
76
  <KolButton _label="Render TextInputs" _variant="primary" onClick={() => handleComponentRender('text')} />
79
77
  <KolButton _label="Render NumberInputs" _variant="primary" onClick={() => handleComponentRender('number')} />
80
78
  <KolButton _label="Render Checkboxes" _variant="primary" onClick={() => handleComponentRender('checkbox')} />
81
- <KolButton _label="Render Skeletons" _variant="primary" onClick={() => handleComponentRender('skeleton')} />
82
79
  <KolButton _label="Clear" _variant="secondary" onClick={handleClear} />
83
80
  </div>
84
81
  </div>
@@ -15,7 +15,6 @@ import { RHFBasic } from './react-hook-form/basic';
15
15
  import { RHFDisabled } from './react-hook-form/disabled';
16
16
  import { SameHeightOfAllFormElements } from './same-height-of-all-form-elements-with-label';
17
17
  import { SameHeightOfAllInteractiveElements } from './same-height-of-all-interactive-elements';
18
- import { Skeleton } from './skeleton';
19
18
  import { StaticForm } from './static-form';
20
19
  import { ToolbarItemOrder } from './toolbar-item-order';
21
20
  import { TooltipPositioning } from './tooltip-positioning';
@@ -43,6 +42,5 @@ export const SCENARIO_ROUTES: Routes = {
43
42
  'accordion-components': AccordionComponentContent,
44
43
  'z-index': ZIndexScenario,
45
44
  'performance-test': PerformanceTest,
46
- skeleton: Skeleton,
47
45
  },
48
46
  };
@@ -1,199 +0,0 @@
1
- import type { FC } from 'react';
2
- import React, { useCallback, useRef, useState } from 'react';
3
-
4
- import { KolButton, KolInputRange, KolSkeleton } from '@public-ui/react-v19';
5
- import { SampleDescription } from '../components/SampleDescription';
6
-
7
- interface EventLogEntry {
8
- timestamp: string;
9
- count: number;
10
- id: number;
11
- }
12
-
13
- export const Skeleton: FC = () => {
14
- const skeletonRef = useRef<HTMLKolSkeletonElement>(null);
15
- const rangeRef = useRef<HTMLKolInputRangeElement>(null);
16
- const initialCount = 3;
17
-
18
- const durationFormatter = new Intl.NumberFormat('de-DE', { style: 'unit', unit: 'millisecond', maximumFractionDigits: 1 });
19
- const timeFormatter = new Intl.DateTimeFormat('de-DE', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
20
-
21
- const [count, setCount] = useState<number>(initialCount);
22
- const [eventLog, setEventLog] = useState<EventLogEntry[]>([]);
23
- const [lastEventTime, setLastEventTime] = useState<string>('');
24
- const [eventCount, setEventCount] = useState<number>(0);
25
- const [skeletonCount, setSkeletonCount] = useState<number>(20);
26
-
27
- // Render benchmark state
28
- const [generation, setGeneration] = useState<number>(0);
29
- const [renderDuration, setRenderDuration] = useState<number | null>(null);
30
- const [isMeasuring, setIsMeasuring] = useState<boolean>(false);
31
-
32
- // Refs for stable values in closures (no stale closure issues)
33
- const renderStartTimeRef = useRef<number>(0);
34
- const expectedCountRef = useRef<number>(20);
35
- const renderedCountRef = useRef<number>(0);
36
-
37
- const handleLoaded = (event: CustomEvent<number>) => {
38
- const now = new Date();
39
- const timestamp = timeFormatter.format(now);
40
- const newEventCount = eventCount + 1;
41
-
42
- setCount(event.detail);
43
- setLastEventTime(timestamp);
44
- setEventCount(newEventCount);
45
-
46
- // Add to event log (keep only last 5 entries)
47
- setEventLog((prev) => {
48
- const newEntry: EventLogEntry = {
49
- timestamp,
50
- count: event.detail,
51
- id: newEventCount,
52
- };
53
- return [newEntry, ...prev.slice(0, 4)];
54
- });
55
- };
56
-
57
- const handleRendered = useCallback(() => {
58
- renderedCountRef.current += 1;
59
-
60
- if (renderedCountRef.current >= expectedCountRef.current) {
61
- const duration = performance.now() - renderStartTimeRef.current;
62
- setRenderDuration(duration);
63
- setIsMeasuring(false);
64
- }
65
- }, []);
66
-
67
- const handleRangeChange = (_event: Event, value: unknown) => {
68
- const newValue = Number(value);
69
- setSkeletonCount(newValue);
70
-
71
- // Start benchmark measurement
72
- renderedCountRef.current = 0;
73
- expectedCountRef.current = newValue;
74
- renderStartTimeRef.current = performance.now();
75
- setRenderDuration(null);
76
- setIsMeasuring(true);
77
- setGeneration((prev) => prev + 1);
78
- };
79
-
80
- const handleRangeBlur = () => {
81
- // Sicherstellen, dass der interne Wert mit dem State synchronisiert ist
82
- if (rangeRef.current) {
83
- rangeRef.current._value = skeletonCount;
84
- }
85
- };
86
-
87
- return (
88
- <>
89
- <SampleDescription>
90
- <p>
91
- KolSkeleton demonstriert Event-Emitter mit automatischem Intervall. Die Komponente emittiert alle 2 Sekunden ein &quot;loaded&quot; Event mit dem
92
- aktuellen Count-Wert. Über die Buttons kann die Komponente getoggled und fokussiert werden. Der interne ClickButton erhöht bei Klick den Counter.
93
- </p>
94
- </SampleDescription>
95
-
96
- <div className="grid md:grid-cols-2 gap-4 mb-4 items-center">
97
- <div className="grid sm:grid-cols-2 gap-4">
98
- <KolButton
99
- _label="Toggle Sichtbarkeit"
100
- _on={{
101
- onClick: () => skeletonRef.current?.toggle(),
102
- }}
103
- _variant="primary"
104
- />
105
- <KolButton
106
- _label="Fokus auf Button"
107
- _on={{
108
- onClick: () => skeletonRef.current?.focus(),
109
- }}
110
- _variant="secondary"
111
- />
112
- </div>
113
- <div className="grid sm:grid-cols-2 gap-4 items-center">
114
- <KolInputRange
115
- ref={rangeRef}
116
- _label="Anzahl der Skeletons"
117
- _hideLabel
118
- _min={1}
119
- _max={10000}
120
- _step={25}
121
- _value={skeletonCount}
122
- _on={{
123
- onChange: handleRangeChange,
124
- onBlur: handleRangeBlur,
125
- }}
126
- />
127
- <span className="text-sm text-gray-600 whitespace-nowrap">{skeletonCount} Skeletons</span>
128
- </div>
129
- </div>
130
-
131
- {/* Render Benchmark */}
132
- <div className="mb-4 px-3 py-2 border border-gray-300 rounded bg-gray-50 flex items-center gap-4 text-sm">
133
- <span className="font-semibold">Benchmark:</span>
134
- <span className={isMeasuring ? 'text-orange-600 font-bold' : renderDuration !== null ? 'text-green-600' : 'text-gray-400'}>
135
- {isMeasuring ? 'Rendering…' : renderDuration !== null ? 'Fertig' : 'Bereit'}
136
- </span>
137
- <span className="font-bold text-blue-600" aria-live="polite">
138
- {renderDuration !== null ? durationFormatter.format(renderDuration) : '—'}
139
- </span>
140
- </div>
141
-
142
- <div className="flex flex-wrap gap-4">
143
- {Array.from({ length: skeletonCount }, (_, idx) => (
144
- <KolSkeleton
145
- key={`skeleton-${generation}-${idx}`}
146
- _name={`Example ${idx}`}
147
- onLoaded={idx === 0 ? handleLoaded : undefined}
148
- onRendered={handleRendered}
149
- ref={idx === 0 ? skeletonRef : undefined}
150
- />
151
- ))}
152
- </div>
153
-
154
- <div className="mt-6 p-4 border border-gray-300 rounded-lg bg-gray-50">
155
- <h3 className="text-lg font-semibold mb-3">Event Monitor</h3>
156
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
157
- <div>
158
- <p className="font-medium">Aktueller Count-Wert:</p>
159
- <p className="text-2xl font-bold text-blue-600" aria-live="polite">
160
- {count}
161
- </p>
162
- </div>
163
- <div>
164
- <p className="font-medium">Letztes Event:</p>
165
- <p className="text-lg" aria-live="polite">
166
- {lastEventTime || 'Noch kein Event empfangen'}
167
- </p>
168
- </div>
169
- </div>
170
- <div className="mt-4">
171
- <p className="font-medium mb-2">
172
- Events empfangen: <span className="font-bold">{eventCount}</span>
173
- </p>
174
- {eventLog.length > 0 && (
175
- <div>
176
- <p className="font-medium mb-2">Event-Historie (letzte 5):</p>
177
- <ul className="text-sm space-y-1 max-h-32 overflow-y-auto">
178
- {eventLog.map((entry) => (
179
- <li key={entry.id} className="flex justify-between items-center p-2 bg-white rounded border">
180
- <span>
181
- #{entry.id}: Count = {entry.count}
182
- </span>
183
- <span className="text-gray-500">{entry.timestamp}</span>
184
- </li>
185
- ))}
186
- </ul>
187
- </div>
188
- )}
189
- </div>
190
- <div className="mt-4 p-3 bg-blue-50 rounded">
191
- <p className="text-sm text-blue-800">
192
- 💡 <strong>Tipp:</strong> Die Komponente emittiert automatisch alle 2 Sekunden ein Event. Klicke auf den &quot;Click Button&quot; in der Komponente,
193
- um den Count-Wert zu erhöhen.
194
- </p>
195
- </div>
196
- </div>
197
- </>
198
- );
199
- };