@public-ui/sample-react 4.6.0-rc.0 → 4.6.0-rc.1

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": "4.6.0-rc.0",
3
+ "version": "4.6.0-rc.1",
4
4
  "description": "This app contains samples for the KoliBri/Public UI",
5
5
  "type": "module",
6
6
  "license": "EUPL-1.2",
@@ -20,8 +20,8 @@
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": "4.6.0-rc.0",
24
- "@public-ui/react-v19": "4.6.0-rc.0"
23
+ "@public-ui/react-v19": "4.6.0-rc.1",
24
+ "@public-ui/react-hook-form-adapter": "4.6.0-rc.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "19.2.18",
@@ -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": "4.6.0-rc.0"
40
+ "@public-ui/components": "4.6.0-rc.1"
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>
@@ -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}
@@ -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
- };