@native-systems/ui 1.0.11 → 1.2.0

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,21 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useForm } from 'react-hook-form';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
2
  import * as React from 'react';
4
- import { useState, createContext, useRef, useContext } from 'react';
3
+ import {
4
+ useMemo,
5
+ Fragment as Fragment$1,
6
+ useState,
7
+ createContext,
8
+ useRef,
9
+ useContext,
10
+ } from 'react';
11
+ import { useForm } from 'react-hook-form';
12
+ import {
13
+ Listbox,
14
+ ListboxButton,
15
+ Transition,
16
+ ListboxOptions,
17
+ ListboxOption,
18
+ } from '@headlessui/react';
5
19
  import {
6
20
  PatternCompiler,
7
21
  eqPlugin,
@@ -11,16 +25,29 @@ import {
11
25
  urlPlugin,
12
26
  } from '@native-systems/utility';
13
27
 
14
- function EyeSlashIcon({ title, titleId, ...props }, svgRef) {
28
+ function MainContentFrame({ children }) {
29
+ return jsx('main', {
30
+ className:
31
+ 'w-full pb-2 overflow-hidden bg-zinc-100 lg:pt-2 lg:pr-2 dark:bg-zinc-950',
32
+ children: jsx('div', {
33
+ className:
34
+ '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',
35
+ children: jsx('div', {
36
+ className: 'mx-auto max-w-[1400px]',
37
+ children: children,
38
+ }),
39
+ }),
40
+ });
41
+ }
42
+
43
+ function ChevronDoubleLeftIcon({ title, titleId, ...props }, svgRef) {
15
44
  return /*#__PURE__*/ React.createElement(
16
45
  'svg',
17
46
  Object.assign(
18
47
  {
19
48
  'xmlns': 'http://www.w3.org/2000/svg',
20
- 'fill': 'none',
21
- 'viewBox': '0 0 24 24',
22
- 'strokeWidth': 1.5,
23
- 'stroke': 'currentColor',
49
+ 'viewBox': '0 0 20 20',
50
+ 'fill': 'currentColor',
24
51
  'aria-hidden': 'true',
25
52
  'data-slot': 'icon',
26
53
  'ref': svgRef,
@@ -38,24 +65,22 @@ function EyeSlashIcon({ title, titleId, ...props }, svgRef) {
38
65
  )
39
66
  : null,
40
67
  /*#__PURE__*/ React.createElement('path', {
41
- strokeLinecap: 'round',
42
- strokeLinejoin: 'round',
43
- d: 'M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88',
68
+ fillRule: 'evenodd',
69
+ 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',
70
+ clipRule: 'evenodd',
44
71
  })
45
72
  );
46
73
  }
47
- const ForwardRef$5 = /*#__PURE__*/ React.forwardRef(EyeSlashIcon);
74
+ const ForwardRef$7 = /*#__PURE__*/ React.forwardRef(ChevronDoubleLeftIcon);
48
75
 
49
- function EyeIcon({ title, titleId, ...props }, svgRef) {
76
+ function ChevronDoubleRightIcon({ title, titleId, ...props }, svgRef) {
50
77
  return /*#__PURE__*/ React.createElement(
51
78
  'svg',
52
79
  Object.assign(
53
80
  {
54
81
  'xmlns': 'http://www.w3.org/2000/svg',
55
- 'fill': 'none',
56
- 'viewBox': '0 0 24 24',
57
- 'strokeWidth': 1.5,
58
- 'stroke': 'currentColor',
82
+ 'viewBox': '0 0 20 20',
83
+ 'fill': 'currentColor',
59
84
  'aria-hidden': 'true',
60
85
  'data-slot': 'icon',
61
86
  'ref': svgRef,
@@ -73,223 +98,15 @@ function EyeIcon({ title, titleId, ...props }, svgRef) {
73
98
  )
74
99
  : null,
75
100
  /*#__PURE__*/ React.createElement('path', {
76
- strokeLinecap: 'round',
77
- strokeLinejoin: 'round',
78
- d: 'M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z',
79
- }),
80
- /*#__PURE__*/ React.createElement('path', {
81
- strokeLinecap: 'round',
82
- strokeLinejoin: 'round',
83
- d: 'M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z',
101
+ fillRule: 'evenodd',
102
+ 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',
103
+ clipRule: 'evenodd',
84
104
  })
85
105
  );
86
106
  }
87
- const ForwardRef$4 = /*#__PURE__*/ React.forwardRef(EyeIcon);
88
-
89
- function InputField({
90
- id,
91
- label,
92
- hideLabel = false,
93
- register,
94
- type,
95
- disabled = false,
96
- required,
97
- autoCompleteId = 'off',
98
- isPasswordField = false,
99
- }) {
100
- const [isPasswordVisible, setIsPasswordVisible] = useState(false);
101
- return jsxs('div', {
102
- className: 'flex flex-col space-y-2',
103
- children: [
104
- !hideLabel
105
- ? jsx('label', {
106
- htmlFor: id,
107
- className:
108
- 'block ml-1 text-sm font-medium text-gray-700 dark:text-white',
109
- children: label,
110
- })
111
- : null,
112
- isPasswordField
113
- ? jsxs('div', {
114
- className: 'relative w-full',
115
- children: [
116
- jsx('input', {
117
- id: id,
118
- required: required,
119
- type: isPasswordVisible ? 'text' : 'password',
120
- autoComplete: autoCompleteId,
121
- placeholder: label,
122
- className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
123
- ...register,
124
- }),
125
- jsx('div', {
126
- className:
127
- '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
- children: isPasswordVisible
129
- ? jsx(ForwardRef$5, {
130
- onClick: () => {
131
- setIsPasswordVisible(false);
132
- },
133
- })
134
- : jsx(ForwardRef$4, {
135
- onClick: () => {
136
- setIsPasswordVisible(true);
137
- },
138
- }),
139
- }),
140
- ],
141
- })
142
- : jsx('input', {
143
- id: id,
144
- required: required,
145
- type: type,
146
- disabled: disabled,
147
- autoComplete: autoCompleteId,
148
- placeholder: label,
149
- className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
150
- ...register,
151
- }),
152
- ],
153
- });
154
- }
155
-
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'),
174
- type: 'text',
175
- hideLabel: hideLabels,
176
- required: true,
177
- autoCompleteId: 'email',
178
- register: register('email', {
179
- required: mapText('form.email.validations.required'),
180
- onChange: (e) => setEmail(e.target.value),
181
- }),
182
- }),
183
- jsx(InputField, {
184
- id: 'password',
185
- label: mapText('auth:form.password.label'),
186
- type: 'password',
187
- hideLabel: hideLabels,
188
- required: true,
189
- autoCompleteId: 'password',
190
- register: register('password', {
191
- required: mapText('form.password.validations.required'),
192
- }),
193
- isPasswordField: true,
194
- }),
195
- jsxs('div', {
196
- children: [
197
- jsx('input', {
198
- type: 'submit',
199
- value: mapText('auth:form.submit.text'),
200
- className:
201
- 'w-full flex justify-center px-4 py-3 text-sm text-white bg-[length:200%_200%] bg-primary-shimmer border-none border rounded-lg shadow-sm transition-transform animate-shimmerdelayed cursor-pointer hover:scale-105 focus:outline-none focus:ring-1 focus:ring-base-600/20 focus:ring-offset-0 dark:focus:ring-base-500',
202
- }),
203
- errorMessage &&
204
- jsx('span', {
205
- className: 'block mt-2.5 text-sm text-red-600',
206
- children: errorMessage,
207
- }),
208
- ],
209
- }),
210
- jsx('div', {
211
- className: 'flex justify-between items-center',
212
- children: jsx('div', {
213
- className: 'text-sm',
214
- children: jsx('button', {
215
- type: 'button',
216
- onClick: () => {
217
- if (onForgotPassword) onForgotPassword(email);
218
- },
219
- className:
220
- 'font-medium text-primary transition-colors hover:text-primary-500 dark:text-white',
221
- children: mapText('auth:form.forgot.text'),
222
- }),
223
- }),
224
- }),
225
- ],
226
- });
227
- };
228
-
229
- function SigninLayout({
230
- mapText,
231
- onSubmit,
232
- errorMessage,
233
- logoSrc,
234
- hideLabels,
235
- onForgotPassword,
236
- }) {
237
- return jsx('div', {
238
- className:
239
- 'sign-in-layout-container size-full z-10 relative flex justify-end items-center p-5 sm:p-10',
240
- children: jsx('div', {
241
- className: 'w-full flex flex-row justify-center items-stretch max-w-xl',
242
- children: jsxs('div', {
243
- className:
244
- 'sign-in-dialog w-full p-5 bg-base-0/70 rounded-lg sm:p-10 dark:bg-base-950/70',
245
- children: [
246
- jsx('img', {
247
- className: 'w-auto h-10 mb-20 object-cover',
248
- src: logoSrc,
249
- alt: '',
250
- }),
251
- jsx('h2', {
252
- className: 'dark:text-white',
253
- children: mapText('auth:form.submit.text'),
254
- }),
255
- jsx('div', {
256
- className: 'mt-5',
257
- children: jsx(SigninForm, {
258
- mapText: mapText,
259
- onSubmit: (values) => onSubmit(values.email, values.password),
260
- errorMessage: errorMessage,
261
- hideLabels: hideLabels,
262
- onForgotPassword: onForgotPassword,
263
- }),
264
- }),
265
- ],
266
- }),
267
- }),
268
- });
269
- }
270
-
271
- var UI = /*#__PURE__*/ Object.freeze({
272
- __proto__: null,
273
- SigninForm: SigninForm,
274
- SigninLayout: SigninLayout,
275
- });
276
-
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
- }
107
+ const ForwardRef$6 = /*#__PURE__*/ React.forwardRef(ChevronDoubleRightIcon);
291
108
 
292
- function ChevronDoubleLeftIcon({ title, titleId, ...props }, svgRef) {
109
+ function ChevronDownIcon({ title, titleId, ...props }, svgRef) {
293
110
  return /*#__PURE__*/ React.createElement(
294
111
  'svg',
295
112
  Object.assign(
@@ -315,47 +132,14 @@ function ChevronDoubleLeftIcon({ title, titleId, ...props }, svgRef) {
315
132
  : null,
316
133
  /*#__PURE__*/ React.createElement('path', {
317
134
  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',
135
+ d: 'M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z',
319
136
  clipRule: 'evenodd',
320
137
  })
321
138
  );
322
139
  }
323
- const ForwardRef$3 = /*#__PURE__*/ React.forwardRef(ChevronDoubleLeftIcon);
140
+ const ForwardRef$5 = /*#__PURE__*/ React.forwardRef(ChevronDownIcon);
324
141
 
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) {
142
+ function ChevronLeftIcon({ title, titleId, ...props }, svgRef) {
359
143
  return /*#__PURE__*/ React.createElement(
360
144
  'svg',
361
145
  Object.assign(
@@ -386,7 +170,7 @@ function ChevronLeftIcon({ title, titleId, ...props }, svgRef) {
386
170
  })
387
171
  );
388
172
  }
389
- const ForwardRef$1 = /*#__PURE__*/ React.forwardRef(ChevronLeftIcon);
173
+ const ForwardRef$4 = /*#__PURE__*/ React.forwardRef(ChevronLeftIcon);
390
174
 
391
175
  function ChevronRightIcon({ title, titleId, ...props }, svgRef) {
392
176
  return /*#__PURE__*/ React.createElement(
@@ -419,7 +203,7 @@ function ChevronRightIcon({ title, titleId, ...props }, svgRef) {
419
203
  })
420
204
  );
421
205
  }
422
- const ForwardRef = /*#__PURE__*/ React.forwardRef(ChevronRightIcon);
206
+ const ForwardRef$3 = /*#__PURE__*/ React.forwardRef(ChevronRightIcon);
423
207
 
424
208
  function Pagination({
425
209
  currentPage,
@@ -443,7 +227,7 @@ function Pagination({
443
227
  'aria-label': 'Zur ersten Seite',
444
228
  'className':
445
229
  '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, {
230
+ 'children': jsx(ForwardRef$7, {
447
231
  className: 'w-5 h-auto',
448
232
  }),
449
233
  }),
@@ -453,7 +237,7 @@ function Pagination({
453
237
  'aria-label': 'Zur vorherigen Seite',
454
238
  'className':
455
239
  '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, {
240
+ 'children': jsx(ForwardRef$4, {
457
241
  className: 'w-5 h-auto',
458
242
  }),
459
243
  }),
@@ -468,7 +252,7 @@ function Pagination({
468
252
  'aria-label': 'Zur nächsten Seite',
469
253
  'className':
470
254
  '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, {
255
+ 'children': jsx(ForwardRef$3, {
472
256
  className: 'w-5 h-5',
473
257
  }),
474
258
  }),
@@ -483,7 +267,7 @@ function Pagination({
483
267
  'aria-label': 'Zur letzten Seite',
484
268
  'className':
485
269
  '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, {
270
+ 'children': jsx(ForwardRef$6, {
487
271
  className: 'w-5 h-5',
488
272
  }),
489
273
  }),
@@ -491,6 +275,270 @@ function Pagination({
491
275
  });
492
276
  }
493
277
 
278
+ function CheckIcon({ title, titleId, ...props }, svgRef) {
279
+ return /*#__PURE__*/ React.createElement(
280
+ 'svg',
281
+ Object.assign(
282
+ {
283
+ 'xmlns': 'http://www.w3.org/2000/svg',
284
+ 'fill': 'none',
285
+ 'viewBox': '0 0 24 24',
286
+ 'strokeWidth': 1.5,
287
+ 'stroke': 'currentColor',
288
+ 'aria-hidden': 'true',
289
+ 'data-slot': 'icon',
290
+ 'ref': svgRef,
291
+ 'aria-labelledby': titleId,
292
+ },
293
+ props
294
+ ),
295
+ title
296
+ ? /*#__PURE__*/ React.createElement(
297
+ 'title',
298
+ {
299
+ id: titleId,
300
+ },
301
+ title
302
+ )
303
+ : null,
304
+ /*#__PURE__*/ React.createElement('path', {
305
+ strokeLinecap: 'round',
306
+ strokeLinejoin: 'round',
307
+ d: 'm4.5 12.75 6 6 9-13.5',
308
+ })
309
+ );
310
+ }
311
+ const ForwardRef$2 = /*#__PURE__*/ React.forwardRef(CheckIcon);
312
+
313
+ function EyeSlashIcon({ title, titleId, ...props }, svgRef) {
314
+ return /*#__PURE__*/ React.createElement(
315
+ 'svg',
316
+ Object.assign(
317
+ {
318
+ 'xmlns': 'http://www.w3.org/2000/svg',
319
+ 'fill': 'none',
320
+ 'viewBox': '0 0 24 24',
321
+ 'strokeWidth': 1.5,
322
+ 'stroke': 'currentColor',
323
+ 'aria-hidden': 'true',
324
+ 'data-slot': 'icon',
325
+ 'ref': svgRef,
326
+ 'aria-labelledby': titleId,
327
+ },
328
+ props
329
+ ),
330
+ title
331
+ ? /*#__PURE__*/ React.createElement(
332
+ 'title',
333
+ {
334
+ id: titleId,
335
+ },
336
+ title
337
+ )
338
+ : null,
339
+ /*#__PURE__*/ React.createElement('path', {
340
+ strokeLinecap: 'round',
341
+ strokeLinejoin: 'round',
342
+ d: 'M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88',
343
+ })
344
+ );
345
+ }
346
+ const ForwardRef$1 = /*#__PURE__*/ React.forwardRef(EyeSlashIcon);
347
+
348
+ function EyeIcon({ title, titleId, ...props }, svgRef) {
349
+ return /*#__PURE__*/ React.createElement(
350
+ 'svg',
351
+ Object.assign(
352
+ {
353
+ 'xmlns': 'http://www.w3.org/2000/svg',
354
+ 'fill': 'none',
355
+ 'viewBox': '0 0 24 24',
356
+ 'strokeWidth': 1.5,
357
+ 'stroke': 'currentColor',
358
+ 'aria-hidden': 'true',
359
+ 'data-slot': 'icon',
360
+ 'ref': svgRef,
361
+ 'aria-labelledby': titleId,
362
+ },
363
+ props
364
+ ),
365
+ title
366
+ ? /*#__PURE__*/ React.createElement(
367
+ 'title',
368
+ {
369
+ id: titleId,
370
+ },
371
+ title
372
+ )
373
+ : null,
374
+ /*#__PURE__*/ React.createElement('path', {
375
+ strokeLinecap: 'round',
376
+ strokeLinejoin: 'round',
377
+ d: 'M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z',
378
+ }),
379
+ /*#__PURE__*/ React.createElement('path', {
380
+ strokeLinecap: 'round',
381
+ strokeLinejoin: 'round',
382
+ d: 'M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z',
383
+ })
384
+ );
385
+ }
386
+ const ForwardRef = /*#__PURE__*/ React.forwardRef(EyeIcon);
387
+
388
+ function r(e) {
389
+ var t,
390
+ f,
391
+ n = '';
392
+ if ('string' == typeof e || 'number' == typeof e) n += e;
393
+ else if ('object' == typeof e)
394
+ if (Array.isArray(e)) {
395
+ var o = e.length;
396
+ for (t = 0; t < o; t++)
397
+ e[t] && (f = r(e[t])) && (n && (n += ' '), (n += f));
398
+ } else for (f in e) e[f] && (n && (n += ' '), (n += f));
399
+ return n;
400
+ }
401
+ function clsx() {
402
+ for (var e, t, f = 0, n = '', o = arguments.length; f < o; f++)
403
+ (e = arguments[f]) && (t = r(e)) && (n && (n += ' '), (n += t));
404
+ return n;
405
+ }
406
+
407
+ function countryCodeToFlag(countryCode) {
408
+ return countryCode
409
+ .toUpperCase()
410
+ .replace(/./g, (char) =>
411
+ String.fromCodePoint(0x1f1e6 + char.charCodeAt(0) - 65)
412
+ );
413
+ }
414
+ function LocaleSelect({
415
+ locales,
416
+ value,
417
+ set,
418
+ className,
419
+ buttonClassName,
420
+ listClassName,
421
+ disabled,
422
+ ariaLabel = 'Select language',
423
+ }) {
424
+ const selected = useMemo(() => {
425
+ var _locales_find, _ref;
426
+ return (_ref =
427
+ (_locales_find = locales.find((l) => l.locale === value)) !== null &&
428
+ _locales_find !== void 0
429
+ ? _locales_find
430
+ : locales[0]) !== null && _ref !== void 0
431
+ ? _ref
432
+ : null;
433
+ }, [locales, value]);
434
+ if (!locales.length) return null;
435
+ var _selected_locale;
436
+ return jsx('div', {
437
+ className: clsx('relative inline-block', className),
438
+ children: jsx(Listbox, {
439
+ value:
440
+ (_selected_locale =
441
+ selected === null || selected === void 0
442
+ ? void 0
443
+ : selected.locale) !== null && _selected_locale !== void 0
444
+ ? _selected_locale
445
+ : null,
446
+ onChange: (nextLocale) => {
447
+ set(nextLocale);
448
+ },
449
+ disabled: disabled,
450
+ children: ({ open }) => {
451
+ var _selected_label;
452
+ return jsxs(Fragment, {
453
+ children: [
454
+ jsxs(ListboxButton, {
455
+ 'aria-label': ariaLabel,
456
+ 'className': clsx(
457
+ 'inline-flex items-center gap-2 px-3 py-2 text-sm border rounded-md',
458
+ 'disabled:opacity-50 disabled:cursor-not-allowed',
459
+ buttonClassName
460
+ ),
461
+ 'children': [
462
+ jsx('span', {
463
+ 'aria-hidden': 'true',
464
+ 'className': 'text-base leading-none',
465
+ 'children': selected
466
+ ? countryCodeToFlag(selected.countryCode)
467
+ : '🏳️',
468
+ }),
469
+ jsx('span', {
470
+ className: 'whitespace-nowrap',
471
+ children:
472
+ (_selected_label =
473
+ selected === null || selected === void 0
474
+ ? void 0
475
+ : selected.label) !== null && _selected_label !== void 0
476
+ ? _selected_label
477
+ : '',
478
+ }),
479
+ jsx(ForwardRef$5, {
480
+ 'aria-hidden': 'true',
481
+ 'className': 'size-4 ml-1',
482
+ }),
483
+ ],
484
+ }),
485
+ jsx(Transition, {
486
+ as: Fragment$1,
487
+ show: open,
488
+ enter: 'transition ease-out duration-100',
489
+ enterFrom: 'opacity-0 translate-y-1',
490
+ enterTo: 'opacity-100 translate-y-0',
491
+ leave: 'transition ease-in duration-75',
492
+ leaveFrom: 'opacity-100 translate-y-0',
493
+ leaveTo: 'opacity-0 translate-y-1',
494
+ children: jsx(ListboxOptions, {
495
+ className: clsx(
496
+ 'z-50 absolute min-w-[12rem] mt-2 overflow-hidden bg-white border rounded-md shadow-lg focus:outline-none',
497
+ listClassName
498
+ ),
499
+ children: locales.map((opt) =>
500
+ jsx(
501
+ ListboxOption,
502
+ {
503
+ value: opt.locale,
504
+ className: ({ focus }) =>
505
+ clsx(
506
+ 'cursor-pointer select-none px-3 py-2 text-sm',
507
+ focus && 'bg-black/5'
508
+ ),
509
+ children: ({ selected: isSelected }) =>
510
+ jsxs('div', {
511
+ className: 'flex items-center gap-2',
512
+ children: [
513
+ jsx('span', {
514
+ 'aria-hidden': 'true',
515
+ 'className': 'text-base leading-none',
516
+ 'children': countryCodeToFlag(opt.countryCode),
517
+ }),
518
+ jsx('span', {
519
+ className: 'flex-1',
520
+ children: opt.label,
521
+ }),
522
+ isSelected &&
523
+ jsx(ForwardRef$2, {
524
+ 'aria-hidden': 'true',
525
+ 'className': 'size-4',
526
+ }),
527
+ ],
528
+ }),
529
+ },
530
+ opt.locale
531
+ )
532
+ ),
533
+ }),
534
+ }),
535
+ ],
536
+ });
537
+ },
538
+ }),
539
+ });
540
+ }
541
+
494
542
  function CancelButton({ onClick }) {
495
543
  return jsx('button', {
496
544
  type: 'button',
@@ -517,23 +565,71 @@ function HowToCloseText() {
517
565
  });
518
566
  }
519
567
 
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;
568
+ function InputField({
569
+ id,
570
+ label,
571
+ hideLabel = false,
572
+ register,
573
+ type,
574
+ disabled = false,
575
+ required,
576
+ autoCompleteId = 'off',
577
+ isPasswordField = false,
578
+ }) {
579
+ const [isPasswordVisible, setIsPasswordVisible] = useState(false);
580
+ return jsxs('div', {
581
+ className: 'flex flex-col space-y-2',
582
+ children: [
583
+ !hideLabel
584
+ ? jsx('label', {
585
+ htmlFor: id,
586
+ className:
587
+ 'block ml-1 text-sm font-medium text-gray-700 dark:text-white',
588
+ children: label,
589
+ })
590
+ : null,
591
+ isPasswordField
592
+ ? jsxs('div', {
593
+ className: 'relative w-full',
594
+ children: [
595
+ jsx('input', {
596
+ id: id,
597
+ required: required,
598
+ type: isPasswordVisible ? 'text' : 'password',
599
+ autoComplete: autoCompleteId,
600
+ placeholder: label,
601
+ className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
602
+ ...register,
603
+ }),
604
+ jsx('div', {
605
+ className:
606
+ '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',
607
+ children: isPasswordVisible
608
+ ? jsx(ForwardRef$1, {
609
+ onClick: () => {
610
+ setIsPasswordVisible(false);
611
+ },
612
+ })
613
+ : jsx(ForwardRef, {
614
+ onClick: () => {
615
+ setIsPasswordVisible(true);
616
+ },
617
+ }),
618
+ }),
619
+ ],
620
+ })
621
+ : jsx('input', {
622
+ id: id,
623
+ required: required,
624
+ type: type,
625
+ disabled: disabled,
626
+ autoComplete: autoCompleteId,
627
+ placeholder: label,
628
+ className: `relative w-full block py-3 pr-10 pl-3 text-sm text-font-950 bg-base-0 border rounded-lg border-base-500/15 appearance-none focus:outline-none focus:ring-primary-500 placeholder-font-400 dark:text-font-0 dark:text-font-100 dark:bg-base-950 dark:placeholder-font-600 ${type === 'number' ? 'text-right' : ''}`,
629
+ ...register,
630
+ }),
631
+ ],
632
+ });
537
633
  }
538
634
 
539
635
  function LoadingSpinner({ className, innerClassName }) {
@@ -586,10 +682,139 @@ var Util = /*#__PURE__*/ Object.freeze({
586
682
  HowToCloseText: HowToCloseText,
587
683
  InputField: InputField,
588
684
  LoadingSpinner: LoadingSpinner,
685
+ LocaleSelect: LocaleSelect,
589
686
  MainContentFrame: MainContentFrame,
590
687
  Pagination: Pagination,
591
688
  SaveButton: SaveButton,
592
689
  Textarea: Textarea,
690
+ countryCodeToFlag: countryCodeToFlag,
691
+ });
692
+
693
+ const SigninForm = ({
694
+ mapText,
695
+ onSubmit,
696
+ errorMessage,
697
+ hideLabels,
698
+ onForgotPassword,
699
+ }) => {
700
+ const { register, handleSubmit, setValue } = useForm({
701
+ shouldUseNativeValidation: true,
702
+ });
703
+ const [email, setEmail] = useState('');
704
+ return jsxs('form', {
705
+ onSubmit: handleSubmit(onSubmit),
706
+ className: 'space-y-6',
707
+ children: [
708
+ jsx(InputField, {
709
+ id: 'email',
710
+ label: mapText('auth:form.email.label'),
711
+ type: 'text',
712
+ hideLabel: hideLabels,
713
+ required: true,
714
+ autoCompleteId: 'email',
715
+ register: register('email', {
716
+ required: mapText('form.email.validations.required'),
717
+ onChange: (event) => {
718
+ setValue('email', event.target.value);
719
+ setEmail(event.target.value);
720
+ },
721
+ }),
722
+ }),
723
+ jsx(InputField, {
724
+ id: 'password',
725
+ label: mapText('auth:form.password.label'),
726
+ type: 'password',
727
+ hideLabel: hideLabels,
728
+ required: true,
729
+ autoCompleteId: 'password',
730
+ register: register('password', {
731
+ required: mapText('form.password.validations.required'),
732
+ onChange: (event) => {
733
+ setValue('password', event.target.value);
734
+ },
735
+ }),
736
+ isPasswordField: true,
737
+ }),
738
+ jsxs('div', {
739
+ children: [
740
+ jsx('input', {
741
+ type: 'submit',
742
+ value: mapText('auth:form.submit.text'),
743
+ className:
744
+ 'w-full flex justify-center px-4 py-3 text-sm text-white bg-[length:200%_200%] bg-primary-shimmer border-none border rounded-lg shadow-sm transition-transform animate-shimmerdelayed cursor-pointer hover:scale-105 focus:outline-none focus:ring-1 focus:ring-base-600/20 focus:ring-offset-0 dark:focus:ring-base-500',
745
+ }),
746
+ errorMessage &&
747
+ jsx('span', {
748
+ className: 'block mt-2.5 text-sm text-red-600',
749
+ children: errorMessage,
750
+ }),
751
+ ],
752
+ }),
753
+ jsx('div', {
754
+ className: 'flex justify-between items-center',
755
+ children: jsx('div', {
756
+ className: 'text-sm',
757
+ children: jsx('button', {
758
+ type: 'button',
759
+ onClick: () => {
760
+ if (onForgotPassword) onForgotPassword(email);
761
+ },
762
+ className:
763
+ 'font-medium text-primary transition-colors hover:text-primary-500 dark:text-white',
764
+ children: mapText('auth:form.forgot.text'),
765
+ }),
766
+ }),
767
+ }),
768
+ ],
769
+ });
770
+ };
771
+
772
+ function SigninLayout({
773
+ mapText,
774
+ onSubmit,
775
+ errorMessage,
776
+ logoSrc,
777
+ hideLabels,
778
+ onForgotPassword,
779
+ }) {
780
+ return jsx('div', {
781
+ className:
782
+ 'sign-in-layout-container size-full z-10 relative flex justify-end items-center p-5 sm:p-10',
783
+ children: jsx('div', {
784
+ className: 'w-full flex flex-row justify-center items-stretch max-w-xl',
785
+ children: jsxs('div', {
786
+ className:
787
+ 'sign-in-dialog w-full p-5 bg-base-0/70 rounded-lg sm:p-10 dark:bg-base-950/70',
788
+ children: [
789
+ jsx('img', {
790
+ className: 'w-auto h-10 mb-20 object-cover',
791
+ src: logoSrc,
792
+ alt: '',
793
+ }),
794
+ jsx('h2', {
795
+ className: 'dark:text-white',
796
+ children: mapText('auth:form.submit.text'),
797
+ }),
798
+ jsx('div', {
799
+ className: 'mt-5',
800
+ children: jsx(SigninForm, {
801
+ mapText: mapText,
802
+ onSubmit: (values) => onSubmit(values.email, values.password),
803
+ errorMessage: errorMessage,
804
+ hideLabels: hideLabels,
805
+ onForgotPassword: onForgotPassword,
806
+ }),
807
+ }),
808
+ ],
809
+ }),
810
+ }),
811
+ });
812
+ }
813
+
814
+ var UI = /*#__PURE__*/ Object.freeze({
815
+ __proto__: null,
816
+ SigninForm: SigninForm,
817
+ SigninLayout: SigninLayout,
593
818
  });
594
819
 
595
820
  const TemplateParserContext = createContext({
@@ -674,6 +899,7 @@ export {
674
899
  HowToCloseText,
675
900
  InputField,
676
901
  LoadingSpinner,
902
+ LocaleSelect,
677
903
  MainContentFrame,
678
904
  Pagination,
679
905
  SaveButton,
@@ -681,6 +907,7 @@ export {
681
907
  SigninLayout,
682
908
  TemplateParserProvider,
683
909
  Textarea,
910
+ countryCodeToFlag,
684
911
  index as default,
685
912
  useTemplateParser,
686
913
  };