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