@native-systems/ui 1.0.10 → 1.1.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/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useForm } from 'react-hook-form';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
2
  import * as React from 'react';
4
3
  import { useState, createContext, useRef, useContext } from 'react';
4
+ import { useForm } from 'react-hook-form';
5
5
  import {
6
6
  PatternCompiler,
7
7
  eqPlugin,
@@ -11,6 +11,249 @@ import {
11
11
  urlPlugin,
12
12
  } from '@native-systems/utility';
13
13
 
14
+ function MainContentFrame({ children }) {
15
+ return jsx('main', {
16
+ className:
17
+ 'w-full pb-2 overflow-hidden bg-zinc-100 lg:pt-2 lg:pr-2 dark:bg-zinc-950',
18
+ children: jsx('div', {
19
+ className:
20
+ 'w-full h-full p-6 content-canvas bg-white border-zinc-950/10 lg:p-10 lg:border lg:rounded-lg lg:shadow-xs dark:bg-zinc-900 dark:border-white/5',
21
+ children: jsx('div', {
22
+ className: 'mx-auto max-w-[1400px]',
23
+ children: children,
24
+ }),
25
+ }),
26
+ });
27
+ }
28
+
29
+ function ChevronDoubleLeftIcon({ title, titleId, ...props }, svgRef) {
30
+ return /*#__PURE__*/ React.createElement(
31
+ 'svg',
32
+ Object.assign(
33
+ {
34
+ 'xmlns': 'http://www.w3.org/2000/svg',
35
+ 'viewBox': '0 0 20 20',
36
+ 'fill': 'currentColor',
37
+ 'aria-hidden': 'true',
38
+ 'data-slot': 'icon',
39
+ 'ref': svgRef,
40
+ 'aria-labelledby': titleId,
41
+ },
42
+ props
43
+ ),
44
+ title
45
+ ? /*#__PURE__*/ React.createElement(
46
+ 'title',
47
+ {
48
+ id: titleId,
49
+ },
50
+ title
51
+ )
52
+ : null,
53
+ /*#__PURE__*/ React.createElement('path', {
54
+ fillRule: 'evenodd',
55
+ d: 'M4.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L6.31 10l3.72-3.72a.75.75 0 1 0-1.06-1.06L4.72 9.47Zm9.25-4.25L9.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L11.31 10l3.72-3.72a.75.75 0 0 0-1.06-1.06Z',
56
+ clipRule: 'evenodd',
57
+ })
58
+ );
59
+ }
60
+ const ForwardRef$5 = /*#__PURE__*/ React.forwardRef(ChevronDoubleLeftIcon);
61
+
62
+ function ChevronDoubleRightIcon({ title, titleId, ...props }, svgRef) {
63
+ return /*#__PURE__*/ React.createElement(
64
+ 'svg',
65
+ Object.assign(
66
+ {
67
+ 'xmlns': 'http://www.w3.org/2000/svg',
68
+ 'viewBox': '0 0 20 20',
69
+ 'fill': 'currentColor',
70
+ 'aria-hidden': 'true',
71
+ 'data-slot': 'icon',
72
+ 'ref': svgRef,
73
+ 'aria-labelledby': titleId,
74
+ },
75
+ props
76
+ ),
77
+ title
78
+ ? /*#__PURE__*/ React.createElement(
79
+ 'title',
80
+ {
81
+ id: titleId,
82
+ },
83
+ title
84
+ )
85
+ : null,
86
+ /*#__PURE__*/ React.createElement('path', {
87
+ fillRule: 'evenodd',
88
+ d: 'M15.28 9.47a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L13.69 10 9.97 6.28a.75.75 0 0 1 1.06-1.06l4.25 4.25ZM6.03 5.22l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L8.69 10 4.97 6.28a.75.75 0 0 1 1.06-1.06Z',
89
+ clipRule: 'evenodd',
90
+ })
91
+ );
92
+ }
93
+ const ForwardRef$4 = /*#__PURE__*/ React.forwardRef(ChevronDoubleRightIcon);
94
+
95
+ function ChevronLeftIcon({ title, titleId, ...props }, svgRef) {
96
+ return /*#__PURE__*/ React.createElement(
97
+ 'svg',
98
+ Object.assign(
99
+ {
100
+ 'xmlns': 'http://www.w3.org/2000/svg',
101
+ 'viewBox': '0 0 20 20',
102
+ 'fill': 'currentColor',
103
+ 'aria-hidden': 'true',
104
+ 'data-slot': 'icon',
105
+ 'ref': svgRef,
106
+ 'aria-labelledby': titleId,
107
+ },
108
+ props
109
+ ),
110
+ title
111
+ ? /*#__PURE__*/ React.createElement(
112
+ 'title',
113
+ {
114
+ id: titleId,
115
+ },
116
+ title
117
+ )
118
+ : null,
119
+ /*#__PURE__*/ React.createElement('path', {
120
+ fillRule: 'evenodd',
121
+ d: 'M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z',
122
+ clipRule: 'evenodd',
123
+ })
124
+ );
125
+ }
126
+ const ForwardRef$3 = /*#__PURE__*/ React.forwardRef(ChevronLeftIcon);
127
+
128
+ function ChevronRightIcon({ title, titleId, ...props }, svgRef) {
129
+ return /*#__PURE__*/ React.createElement(
130
+ 'svg',
131
+ Object.assign(
132
+ {
133
+ 'xmlns': 'http://www.w3.org/2000/svg',
134
+ 'viewBox': '0 0 20 20',
135
+ 'fill': 'currentColor',
136
+ 'aria-hidden': 'true',
137
+ 'data-slot': 'icon',
138
+ 'ref': svgRef,
139
+ 'aria-labelledby': titleId,
140
+ },
141
+ props
142
+ ),
143
+ title
144
+ ? /*#__PURE__*/ React.createElement(
145
+ 'title',
146
+ {
147
+ id: titleId,
148
+ },
149
+ title
150
+ )
151
+ : null,
152
+ /*#__PURE__*/ React.createElement('path', {
153
+ fillRule: 'evenodd',
154
+ d: 'M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z',
155
+ clipRule: 'evenodd',
156
+ })
157
+ );
158
+ }
159
+ const ForwardRef$2 = /*#__PURE__*/ React.forwardRef(ChevronRightIcon);
160
+
161
+ function Pagination({
162
+ currentPage,
163
+ totalPages,
164
+ hasPrevPage,
165
+ hasNextPage,
166
+ goToFirstPage,
167
+ goToPreviousPage,
168
+ goToNextPage,
169
+ goToLastPage,
170
+ }) {
171
+ if (totalPages === 0) {
172
+ return null;
173
+ }
174
+ return jsxs('div', {
175
+ className: 'w-full flex justify-center items-center gap-x-2 mt-6',
176
+ children: [
177
+ jsx('button', {
178
+ 'onClick': goToFirstPage,
179
+ 'disabled': !hasPrevPage,
180
+ 'aria-label': 'Zur ersten Seite',
181
+ 'className':
182
+ 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
183
+ 'children': jsx(ForwardRef$5, {
184
+ className: 'w-5 h-auto',
185
+ }),
186
+ }),
187
+ jsx('button', {
188
+ 'onClick': goToPreviousPage,
189
+ 'disabled': !hasPrevPage,
190
+ 'aria-label': 'Zur vorherigen Seite',
191
+ 'className':
192
+ 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
193
+ 'children': jsx(ForwardRef$3, {
194
+ className: 'w-5 h-auto',
195
+ }),
196
+ }),
197
+ jsx('span', {
198
+ className:
199
+ 'size-10 flex justify-center items-center text-sm text-black rounded-md dark:text-white',
200
+ children: currentPage,
201
+ }),
202
+ jsx('button', {
203
+ 'onClick': goToNextPage,
204
+ 'disabled': !hasNextPage,
205
+ 'aria-label': 'Zur nächsten Seite',
206
+ 'className':
207
+ 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
208
+ 'children': jsx(ForwardRef$2, {
209
+ className: 'w-5 h-5',
210
+ }),
211
+ }),
212
+ jsx('button', {
213
+ 'onClick': () =>
214
+ goToLastPage(
215
+ totalPages !== null && totalPages !== void 0
216
+ ? totalPages
217
+ : currentPage
218
+ ),
219
+ 'disabled': !hasNextPage,
220
+ 'aria-label': 'Zur letzten Seite',
221
+ 'className':
222
+ 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
223
+ 'children': jsx(ForwardRef$4, {
224
+ className: 'w-5 h-5',
225
+ }),
226
+ }),
227
+ ],
228
+ });
229
+ }
230
+
231
+ function CancelButton({ onClick }) {
232
+ return jsx('button', {
233
+ type: 'button',
234
+ className:
235
+ 'px-5 py-1.5 isolate text-sm font-semibold text-white bg-zinc-500 rounded-lg transition-colors cursor-pointer hover:bg-zinc-400 ',
236
+ onClick: onClick,
237
+ children: 'Cancel',
238
+ });
239
+ }
240
+
241
+ function ErrorDisplay({ error }) {
242
+ if (!error) return null;
243
+ return jsx('div', {
244
+ className:
245
+ 'error-display p-4 mb-4 text-red-700 bg-red-100 border rounded border-red-400',
246
+ children: error,
247
+ });
248
+ }
249
+
250
+ function HowToCloseText() {
251
+ return jsx('p', {
252
+ className: 'absolute top-full mt-2 text-xs text-black dark:text-white',
253
+ children: 'Schließen: außerhalb klicken oder die Esc-Taste drücken',
254
+ });
255
+ }
256
+
14
257
  function EyeSlashIcon({ title, titleId, ...props }, svgRef) {
15
258
  return /*#__PURE__*/ React.createElement(
16
259
  'svg',
@@ -44,7 +287,7 @@ function EyeSlashIcon({ title, titleId, ...props }, svgRef) {
44
287
  })
45
288
  );
46
289
  }
47
- const ForwardRef$5 = /*#__PURE__*/ React.forwardRef(EyeSlashIcon);
290
+ const ForwardRef$1 = /*#__PURE__*/ React.forwardRef(EyeSlashIcon);
48
291
 
49
292
  function EyeIcon({ title, titleId, ...props }, svgRef) {
50
293
  return /*#__PURE__*/ React.createElement(
@@ -84,7 +327,7 @@ function EyeIcon({ title, titleId, ...props }, svgRef) {
84
327
  })
85
328
  );
86
329
  }
87
- const ForwardRef$4 = /*#__PURE__*/ React.forwardRef(EyeIcon);
330
+ const ForwardRef = /*#__PURE__*/ React.forwardRef(EyeIcon);
88
331
 
89
332
  function InputField({
90
333
  id,
@@ -126,12 +369,12 @@ function InputField({
126
369
  className:
127
370
  'size-5 absolute top-1/2 right-2 -translate-y-1/2 text-font-400 transition-colors cursor-pointer hover:text-font-300 dark:text-font-600 dark:hover:text-font-500',
128
371
  children: isPasswordVisible
129
- ? jsx(ForwardRef$5, {
372
+ ? jsx(ForwardRef$1, {
130
373
  onClick: () => {
131
374
  setIsPasswordVisible(false);
132
375
  },
133
376
  })
134
- : jsx(ForwardRef$4, {
377
+ : jsx(ForwardRef, {
135
378
  onClick: () => {
136
379
  setIsPasswordVisible(true);
137
380
  },
@@ -153,31 +396,109 @@ function InputField({
153
396
  });
154
397
  }
155
398
 
156
- const SigninForm = ({
157
- mapText,
158
- onSubmit,
159
- errorMessage,
160
- hideLabels,
161
- onForgotPassword,
162
- }) => {
163
- const { register, handleSubmit } = useForm({
164
- shouldUseNativeValidation: true,
165
- });
166
- const [email, setEmail] = useState('');
167
- return jsxs('form', {
168
- onSubmit: handleSubmit(onSubmit),
169
- className: 'space-y-6',
170
- children: [
171
- jsx(InputField, {
172
- id: 'email',
173
- label: mapText('auth:form.email.label'),
399
+ function r(e) {
400
+ var t,
401
+ f,
402
+ n = '';
403
+ if ('string' == typeof e || 'number' == typeof e) n += e;
404
+ else if ('object' == typeof e)
405
+ if (Array.isArray(e)) {
406
+ var o = e.length;
407
+ for (t = 0; t < o; t++)
408
+ e[t] && (f = r(e[t])) && (n && (n += ' '), (n += f));
409
+ } else for (f in e) e[f] && (n && (n += ' '), (n += f));
410
+ return n;
411
+ }
412
+ function clsx() {
413
+ for (var e, t, f = 0, n = '', o = arguments.length; f < o; f++)
414
+ (e = arguments[f]) && (t = r(e)) && (n && (n += ' '), (n += t));
415
+ return n;
416
+ }
417
+
418
+ function LoadingSpinner({ className, innerClassName }) {
419
+ return jsx('div', {
420
+ className: clsx(
421
+ 'loading-spinner w-full h-full flex flex-col justify-center items-center px-1',
422
+ className
423
+ ),
424
+ children: jsx('div', {
425
+ 'className': clsx(
426
+ 'size-5 inline-block border-[3px] border-t-transparent rounded-full border-current animate-spin',
427
+ innerClassName
428
+ ),
429
+ 'role': 'status',
430
+ 'aria-label': 'loading',
431
+ 'children': jsx('span', {
432
+ className: 'sr-only',
433
+ children: 'Loading...',
434
+ }),
435
+ }),
436
+ });
437
+ }
438
+
439
+ function SaveButton({ isSaving, onClick, disabled }) {
440
+ return jsx('button', {
441
+ type: 'submit',
442
+ className:
443
+ 'px-5 py-1.5 isolate text-sm font-semibold text-white bg-primary-500 rounded-lg transition-colors cursor-pointer disabled:bg-zinc-300 disabled:cursor-default enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
444
+ onClick: onClick,
445
+ disabled: disabled || isSaving,
446
+ children: isSaving ? jsx(LoadingSpinner, {}) : 'Save',
447
+ });
448
+ }
449
+
450
+ function Textarea({ value, onChange, rows = 2 }) {
451
+ return jsx('textarea', {
452
+ className: clsx(
453
+ 'w-full block px-3 py-1.5 mt-3 text-sm/6 text-white bg-white/5 border-none rounded-lg'
454
+ ),
455
+ rows: rows,
456
+ value: value,
457
+ onChange: (e) => onChange(e.target.value),
458
+ });
459
+ }
460
+
461
+ var Util = /*#__PURE__*/ Object.freeze({
462
+ __proto__: null,
463
+ CancelButton: CancelButton,
464
+ ErrorDisplay: ErrorDisplay,
465
+ HowToCloseText: HowToCloseText,
466
+ InputField: InputField,
467
+ LoadingSpinner: LoadingSpinner,
468
+ MainContentFrame: MainContentFrame,
469
+ Pagination: Pagination,
470
+ SaveButton: SaveButton,
471
+ Textarea: Textarea,
472
+ });
473
+
474
+ const SigninForm = ({
475
+ mapText,
476
+ onSubmit,
477
+ errorMessage,
478
+ hideLabels,
479
+ onForgotPassword,
480
+ }) => {
481
+ const { register, handleSubmit, setValue } = useForm({
482
+ shouldUseNativeValidation: true,
483
+ });
484
+ const [email, setEmail] = useState('');
485
+ return jsxs('form', {
486
+ onSubmit: handleSubmit(onSubmit),
487
+ className: 'space-y-6',
488
+ children: [
489
+ jsx(InputField, {
490
+ id: 'email',
491
+ label: mapText('auth:form.email.label'),
174
492
  type: 'text',
175
493
  hideLabel: hideLabels,
176
494
  required: true,
177
495
  autoCompleteId: 'email',
178
496
  register: register('email', {
179
497
  required: mapText('form.email.validations.required'),
180
- onChange: (e) => setEmail(e.target.value),
498
+ onChange: (event) => {
499
+ setValue('email', event.target.value);
500
+ setEmail(event.target.value);
501
+ },
181
502
  }),
182
503
  }),
183
504
  jsx(InputField, {
@@ -189,6 +510,9 @@ const SigninForm = ({
189
510
  autoCompleteId: 'password',
190
511
  register: register('password', {
191
512
  required: mapText('form.password.validations.required'),
513
+ onChange: (event) => {
514
+ setValue('password', event.target.value);
515
+ },
192
516
  }),
193
517
  isPasswordField: true,
194
518
  }),
@@ -274,324 +598,6 @@ var UI = /*#__PURE__*/ Object.freeze({
274
598
  SigninLayout: SigninLayout,
275
599
  });
276
600
 
277
- function MainContentFrame({ children }) {
278
- return jsx('main', {
279
- className:
280
- 'w-full pb-2 overflow-hidden bg-zinc-100 lg:pt-2 lg:pr-2 dark:bg-zinc-950',
281
- children: jsx('div', {
282
- className:
283
- 'w-full h-full p-6 content-canvas bg-white border-zinc-950/10 lg:p-10 lg:border lg:rounded-lg lg:shadow-xs dark:bg-zinc-900 dark:border-white/5',
284
- children: jsx('div', {
285
- className: 'mx-auto max-w-[1400px]',
286
- children: children,
287
- }),
288
- }),
289
- });
290
- }
291
-
292
- function ChevronDoubleLeftIcon({ title, titleId, ...props }, svgRef) {
293
- return /*#__PURE__*/ React.createElement(
294
- 'svg',
295
- Object.assign(
296
- {
297
- 'xmlns': 'http://www.w3.org/2000/svg',
298
- 'viewBox': '0 0 20 20',
299
- 'fill': 'currentColor',
300
- 'aria-hidden': 'true',
301
- 'data-slot': 'icon',
302
- 'ref': svgRef,
303
- 'aria-labelledby': titleId,
304
- },
305
- props
306
- ),
307
- title
308
- ? /*#__PURE__*/ React.createElement(
309
- 'title',
310
- {
311
- id: titleId,
312
- },
313
- title
314
- )
315
- : null,
316
- /*#__PURE__*/ React.createElement('path', {
317
- fillRule: 'evenodd',
318
- d: 'M4.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L6.31 10l3.72-3.72a.75.75 0 1 0-1.06-1.06L4.72 9.47Zm9.25-4.25L9.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L11.31 10l3.72-3.72a.75.75 0 0 0-1.06-1.06Z',
319
- clipRule: 'evenodd',
320
- })
321
- );
322
- }
323
- const ForwardRef$3 = /*#__PURE__*/ React.forwardRef(ChevronDoubleLeftIcon);
324
-
325
- function ChevronDoubleRightIcon({ title, titleId, ...props }, svgRef) {
326
- return /*#__PURE__*/ React.createElement(
327
- 'svg',
328
- Object.assign(
329
- {
330
- 'xmlns': 'http://www.w3.org/2000/svg',
331
- 'viewBox': '0 0 20 20',
332
- 'fill': 'currentColor',
333
- 'aria-hidden': 'true',
334
- 'data-slot': 'icon',
335
- 'ref': svgRef,
336
- 'aria-labelledby': titleId,
337
- },
338
- props
339
- ),
340
- title
341
- ? /*#__PURE__*/ React.createElement(
342
- 'title',
343
- {
344
- id: titleId,
345
- },
346
- title
347
- )
348
- : null,
349
- /*#__PURE__*/ React.createElement('path', {
350
- fillRule: 'evenodd',
351
- d: 'M15.28 9.47a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L13.69 10 9.97 6.28a.75.75 0 0 1 1.06-1.06l4.25 4.25ZM6.03 5.22l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L8.69 10 4.97 6.28a.75.75 0 0 1 1.06-1.06Z',
352
- clipRule: 'evenodd',
353
- })
354
- );
355
- }
356
- const ForwardRef$2 = /*#__PURE__*/ React.forwardRef(ChevronDoubleRightIcon);
357
-
358
- function ChevronLeftIcon({ title, titleId, ...props }, svgRef) {
359
- return /*#__PURE__*/ React.createElement(
360
- 'svg',
361
- Object.assign(
362
- {
363
- 'xmlns': 'http://www.w3.org/2000/svg',
364
- 'viewBox': '0 0 20 20',
365
- 'fill': 'currentColor',
366
- 'aria-hidden': 'true',
367
- 'data-slot': 'icon',
368
- 'ref': svgRef,
369
- 'aria-labelledby': titleId,
370
- },
371
- props
372
- ),
373
- title
374
- ? /*#__PURE__*/ React.createElement(
375
- 'title',
376
- {
377
- id: titleId,
378
- },
379
- title
380
- )
381
- : null,
382
- /*#__PURE__*/ React.createElement('path', {
383
- fillRule: 'evenodd',
384
- d: 'M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z',
385
- clipRule: 'evenodd',
386
- })
387
- );
388
- }
389
- const ForwardRef$1 = /*#__PURE__*/ React.forwardRef(ChevronLeftIcon);
390
-
391
- function ChevronRightIcon({ title, titleId, ...props }, svgRef) {
392
- return /*#__PURE__*/ React.createElement(
393
- 'svg',
394
- Object.assign(
395
- {
396
- 'xmlns': 'http://www.w3.org/2000/svg',
397
- 'viewBox': '0 0 20 20',
398
- 'fill': 'currentColor',
399
- 'aria-hidden': 'true',
400
- 'data-slot': 'icon',
401
- 'ref': svgRef,
402
- 'aria-labelledby': titleId,
403
- },
404
- props
405
- ),
406
- title
407
- ? /*#__PURE__*/ React.createElement(
408
- 'title',
409
- {
410
- id: titleId,
411
- },
412
- title
413
- )
414
- : null,
415
- /*#__PURE__*/ React.createElement('path', {
416
- fillRule: 'evenodd',
417
- d: 'M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z',
418
- clipRule: 'evenodd',
419
- })
420
- );
421
- }
422
- const ForwardRef = /*#__PURE__*/ React.forwardRef(ChevronRightIcon);
423
-
424
- function Pagination({
425
- currentPage,
426
- totalPages,
427
- hasPrevPage,
428
- hasNextPage,
429
- goToFirstPage,
430
- goToPreviousPage,
431
- goToNextPage,
432
- goToLastPage,
433
- }) {
434
- if (totalPages === 0) {
435
- return null;
436
- }
437
- return jsxs('div', {
438
- className: 'w-full flex justify-center items-center gap-x-2 mt-6',
439
- children: [
440
- jsx('button', {
441
- 'onClick': goToFirstPage,
442
- 'disabled': !hasPrevPage,
443
- 'aria-label': 'Zur ersten Seite',
444
- 'className':
445
- 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
446
- 'children': jsx(ForwardRef$3, {
447
- className: 'w-5 h-auto',
448
- }),
449
- }),
450
- jsx('button', {
451
- 'onClick': goToPreviousPage,
452
- 'disabled': !hasPrevPage,
453
- 'aria-label': 'Zur vorherigen Seite',
454
- 'className':
455
- 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
456
- 'children': jsx(ForwardRef$1, {
457
- className: 'w-5 h-auto',
458
- }),
459
- }),
460
- jsx('span', {
461
- className:
462
- 'size-10 flex justify-center items-center text-sm text-black rounded-md dark:text-white',
463
- children: currentPage,
464
- }),
465
- jsx('button', {
466
- 'onClick': goToNextPage,
467
- 'disabled': !hasNextPage,
468
- 'aria-label': 'Zur nächsten Seite',
469
- 'className':
470
- 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
471
- 'children': jsx(ForwardRef, {
472
- className: 'w-5 h-5',
473
- }),
474
- }),
475
- jsx('button', {
476
- 'onClick': () =>
477
- goToLastPage(
478
- totalPages !== null && totalPages !== void 0
479
- ? totalPages
480
- : currentPage
481
- ),
482
- 'disabled': !hasNextPage,
483
- 'aria-label': 'Zur letzten Seite',
484
- 'className':
485
- 'flex gap-0.5 px-4 py-2.5 text-sm text-white bg-primary-500 rounded-lg transition-colors disabled:bg-zinc-300 enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
486
- 'children': jsx(ForwardRef$2, {
487
- className: 'w-5 h-5',
488
- }),
489
- }),
490
- ],
491
- });
492
- }
493
-
494
- function CancelButton({ onClick }) {
495
- return jsx('button', {
496
- type: 'button',
497
- className:
498
- 'px-5 py-1.5 isolate text-sm font-semibold text-white bg-zinc-500 rounded-lg transition-colors cursor-pointer hover:bg-zinc-400 ',
499
- onClick: onClick,
500
- children: 'Cancel',
501
- });
502
- }
503
-
504
- function ErrorDisplay({ error }) {
505
- if (!error) return null;
506
- return jsx('div', {
507
- className:
508
- 'error-display p-4 mb-4 text-red-700 bg-red-100 border rounded border-red-400',
509
- children: error,
510
- });
511
- }
512
-
513
- function HowToCloseText() {
514
- return jsx('p', {
515
- className: 'absolute top-full mt-2 text-xs text-black dark:text-white',
516
- children: 'Schließen: außerhalb klicken oder die Esc-Taste drücken',
517
- });
518
- }
519
-
520
- function r(e) {
521
- var t,
522
- f,
523
- n = '';
524
- if ('string' == typeof e || 'number' == typeof e) n += e;
525
- else if ('object' == typeof e)
526
- if (Array.isArray(e)) {
527
- var o = e.length;
528
- for (t = 0; t < o; t++)
529
- e[t] && (f = r(e[t])) && (n && (n += ' '), (n += f));
530
- } else for (f in e) e[f] && (n && (n += ' '), (n += f));
531
- return n;
532
- }
533
- function clsx() {
534
- for (var e, t, f = 0, n = '', o = arguments.length; f < o; f++)
535
- (e = arguments[f]) && (t = r(e)) && (n && (n += ' '), (n += t));
536
- return n;
537
- }
538
-
539
- function LoadingSpinner({ className, innerClassName }) {
540
- return jsx('div', {
541
- className: clsx(
542
- 'loading-spinner w-full h-full flex flex-col justify-center items-center px-1',
543
- className
544
- ),
545
- children: jsx('div', {
546
- 'className': clsx(
547
- 'size-5 inline-block border-[3px] border-t-transparent rounded-full border-current animate-spin',
548
- innerClassName
549
- ),
550
- 'role': 'status',
551
- 'aria-label': 'loading',
552
- 'children': jsx('span', {
553
- className: 'sr-only',
554
- children: 'Loading...',
555
- }),
556
- }),
557
- });
558
- }
559
-
560
- function SaveButton({ isSaving, onClick, disabled }) {
561
- return jsx('button', {
562
- type: 'submit',
563
- className:
564
- 'px-5 py-1.5 isolate text-sm font-semibold text-white bg-primary-500 rounded-lg transition-colors cursor-pointer disabled:bg-zinc-300 disabled:cursor-default enabled:hover:bg-primary-400 dark:disabled:bg-zinc-800',
565
- onClick: onClick,
566
- disabled: disabled || isSaving,
567
- children: isSaving ? jsx(LoadingSpinner, {}) : 'Save',
568
- });
569
- }
570
-
571
- function Textarea({ value, onChange, rows = 2 }) {
572
- return jsx('textarea', {
573
- className: clsx(
574
- 'w-full block px-3 py-1.5 mt-3 text-sm/6 text-white bg-white/5 border-none rounded-lg'
575
- ),
576
- rows: rows,
577
- value: value,
578
- onChange: (e) => onChange(e.target.value),
579
- });
580
- }
581
-
582
- var Util = /*#__PURE__*/ Object.freeze({
583
- __proto__: null,
584
- CancelButton: CancelButton,
585
- ErrorDisplay: ErrorDisplay,
586
- HowToCloseText: HowToCloseText,
587
- InputField: InputField,
588
- LoadingSpinner: LoadingSpinner,
589
- MainContentFrame: MainContentFrame,
590
- Pagination: Pagination,
591
- SaveButton: SaveButton,
592
- Textarea: Textarea,
593
- });
594
-
595
601
  const TemplateParserContext = createContext({
596
602
  parse: () => String(),
597
603
  addToTemporaryView: () => {},